RBuster's Forum Posts

  • dropbox.com/s/9xmf8rhsypwojxf/shuffle_and_reorder.capx

    Thanks for the example.

    This or something similar I already managed to do :)

    What I need is to use the frame numbers to identify each letter position. This is the correct result:

  • The end result is pretty much the same for either shuffle. I'm always on the look for a simpler way to do it.

    You can do that rearranging with just text like so:

    listA = "DCAB"
    listB = "3142"
    listC = ""
    
    start of layout
    repeat 4 times
    -- add mid(listA, find(listB, str(loopindex+1)), 1) to listC

    To do it with picking sprites it would be tedious. You can convert a row of sprites to text with:

    list = ""
    
    start of layout
    sprite: group=0
    for each sprite ordered by sprite.x
    -- add str(sprite.animationFrame) to list

    or you can use one of these in the add to list action if you want named frames

    mid("ABCD", sprite.animationFrame, 1)

    mid("1234", sprite.animationFrame, 1)

    Thank you very much! This command to generate the lists is very useful but I think I don't know how to use it correctly. I spent all morning trying to implement it so I could only say thank you, but I couldn't.

    I have to cross two pieces of information to be able to find the third.

    The situation is like this:

    1) I have the 4 letters being generated randomly and being displayed in 4 instances of sprite1 (eg DABC). The list of frames is stored in the variable seqLetters (3012)

    2) I have the 4 numbers being randomly generated and being displayed in 4 instances of sprite2 (eg 4132). The frame list is stored in the seqNumbers variable (3021)

    Problem:

    Now I have to show the result in the 4 instances of sprite3, positioning each letter present in sprite1, in the position determined by sprite2 (ex. CDBA), that is, first the letter of position 4, then the letter of position 1, then the letter of position 3 and finally the letter of position 2)

    I'm using the first command block you suggested, but I can't get the result.

    repeat 4 times
    --add mid(seqLetters, find(seqNumbers, str(loopindex+1)), 1) to seq
    
    for each sprite3 order by sprite1.X ascending
    -- set Animation Frame to int(mid(seq, loopindex, 1))
    
  • I really don't understand. It seems to be the same as what the last capx does. I used the digits 0123 instead of ABCD mainly as a simplification. You can set the frame images to whatever.

    Anyways I had another idea on how to do the shuffling. Might me useful.

    Basically a1, a2 and a3 are the three answers. a1 is the correct one. ansIndex is a number 0-2 that offsets the order of the answers. The final step is to display the three answers by converting ABCD to 0123 to set the frames.

    Events 1-7 is enough to generate the answers. You can use any other solution to display them after that.

    https://www.dropbox.com/s/fusumitrtn0q3ya/shuffle_combinations2.capx?dl=1

    Thank you so much for the effort to help me. I'll make sure to buy you several coffees :)

    Could I continue to use the previous way to shuffle? I wouldn't want to change that now. I'm using your first example as a base. I know this game is a bit confusing and I'm not concerned with its mechanics anymore but with some features of C3 that I can use to improve it.

    A question: I am using use 1 sprite with 4 frames with letters and it will be automatically shuffled. I created another sprite with 4 frames with numbers, also shuffled, and the function of the numbers is to serve as a sequence that I have to order the letter frames.

    For example:

    The first sprite (letters) with shuffled frames resulted in DCAB

    The second sprite (numbers) with the shuffled frames resulted in 3142

    I would have to reorder the instances of the first sprite so that it positions the frames according to the numbers of the second sprite. Would be like this:

    D (3) = would have to go to the third position

    C (1) = would have to go to the first position

    A (4) = would have to go to the fourth position

    B (2) = would have to go to the second position

    How do I distinguish each of the first sprite's instances to change the frames according to the new order?

  • I fixed that issue so redownload. It should always show the answer sequence now.

    Thanks for fixing the issue

    I don’t understand the first part of your question though.

    Best I understand you have want three four digit answers. One you can specify and the other two are shuffled versions of that.

    I had the digits start at 0 instead of 1, but all the numbers will be shuffled versions of 0123.

    I need to have 5 information on screen that I have to generate:

    - Original order (letters instead of numbers)

    - Correct order (letters too)

    - 3 answers (1 correct + 2 incorrect)

    When I generate the 3 answer options I need to have generated before the original order and the shuffled order (correct order) before.

    If we think only in frames, I need to shuffle the 4 frames of the original order (sprite or animation) and I need to shuffle the 4 frames in the correct order. So I need to create 3 answer options: 1 with the correct order that is the same of the correct order according with the each element of the original order position, and 2 more option with wrong answers (anything but the sequence of the right answer)

    Example

    I shuffle the 4 frames of the original order = ACDB

    I shuffle the 4 frames of the correct order = BDAC

    Correct answer based on the position of each element of the original order: 4312

    In this case, I need to know in which position each frames of the scrambled order sequence is, according to the positioning of these same frames in the original order.

    I hope this is not confusing to understand. Sorry if it is.

  • The second example does that. You specify the sequence in the global variable and it’s placed in one of the three groups of three.

    But would it be possible for me to determine the shuffled order and the correct order through the predefined numerical sequence, remembering that they are related to each other and not only to the numerical sequence? If so, could you explain to me how to do this?

    What about the problem of sometimes not showing the sequence of numbers (frames) that I defined in the variable "answer"/command of the variable "asindex"? Did you get this same issue?

  • Ah, that's a bit different.

    Here's one way.

    https://www.dropbox.com/s/k4pdvewd4qbp4y8/shuffle_combinations.capx?dl=1

    And modified if you want a specific combination included in the mix.

    https://www.dropbox.com/s/fv39mxvfsx41vsn/shuffle_combinations_with_a_predefined.capx?dl=1

    Thank you R0J0hound

    I just saw your examples. In this case, the 3 answer options are being drawn, right? Is it possible to include in this same process the original password (randomly drawn letters that will dictate the original sequence (scrambled password)) and the correct password (letters that represent the password in the right order)?

    Just to be clear, the user will see the scrambled password and the correct password and will have to find among the answer options the sequence of numbers that determines the order of the correct password based on the order of the scrambled password.

    For example:

    Shuffled order: CBAD (Order: C=1/B=2/A=3/D=4)

    Correct order: ACDB

    - As "A" appears in the third place of the shuffled order, it will represent the "A" of the correct answer in the first place.(3XXX)

    - The "C" is in the 1st place of the shuffled order, the 1 will take the place of the "C" in the second place of the correct order (31XX)

    - The "D" appears in the fourth place of the shuffled order and in the third position of the correct order. (314X)

    - And finally, the "B", which appears in the second place of the shuffled order and in the fourth place of the correct order (3142)

    Then the system would need to generate one correct answer (3142) and two wrong answers.

    EDITED: I tested CAPX with the predefined combination, and several times the combination I defined did not appear among the 3 answer options. Could you say why this happens?

  • I thought it was confusing to apply what was shown and I believe I didn't express myself correctly when I talked about my question. So I decided to talk a little about this stage of the game I'm creating.

    It's a simple password game where there will be symbols (here represented by letters) and answers in numbers that determine the correct position of the letters. The player will have to choose which one shows the correct order among the options.

    Illustrating the information:

    - ABCD (it is the order in which the password appears: A=1/B=2/C=3/D=4)

    - DCBA (is the correct password order)

    Answer options:

    1234

    3214

    4321 (correct answer)

    Both symbols and numerical orders will have to be generated automatically at the same time.

    I'm going to use images, both for the letters and also for the numbers. Maybe I should use a sprite with 2 animations (one with letters and one with numbers) and with 4 frames each, which will be drawn. The issue is that I will have to use instances of the same sprite for all the game items (password in the original order/password reorder numeric sequence/password in the correct order/2 wrong answers and 1 right answer) and thus identify each one of them. Would this be the best solution?

  • Thank you so much and R0J0hound for the suggestions and examples.

    I will test both solutions and return later if I have any questions or give feedback.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • But in this case I need to register all the possibilities in the array, right? I want to create these combinations on fly (randomly)

  • I intend to create some random combinations of symbols distributed in 4 frames of two sprites for the user to identify which are the same and I wanted to know how I can do to avoid that the combinations are repeated in the next plays. Any simple suggestions for this?

    Thanks

  • Thank you!

  • Thank you lennaert

    I believe I found the right example/tutorial to accomplish it: construct.net/en/tutorials/tracking-users-ajax-php-mysql-1061

  • lennaert Thank you for the reply. From what I understand, it doesn't seem like a very complicated thing to do. Do you know where I can find an example of how to create the PHP page and after that how to interact with the WordPress database? I need to understand this very well to see if I really have conditions or not to accept this project.

  • I intend to create a game to be published in a WordPress page (inside of an iFrame) and I need to register the history of each user who plays in the same database of the site (WordPress), recording score, length of stay, results (won or lost), among others. Would it be possible? If so, could you explain to me how to do it? Thanks.

    Tagged:

  • Hey dop2000

    Thanks for answering. My idea is to use a device that will have some small pieces of conductive foam and I need the app to confirm whether the distance between these pieces of foam is correct or not and do something after that. Could I do this using this plugin?