RBuster's Recent Forum Activity

  • I intend to create a light/dark layout and I want to change the assets of each condition using different animations in the same sprite. Is there a way for animations to always show the same frame as the current one when I change from one animation to another?

  • No problem.

    I had tried doing this for layout 1 example but it didn't work and I can't even imagine why.

    I will keep trying

  • Thanks for replying, R0J0hound

    I think that now I could not follow your reasoning. It's so simple that I can't decipher it :) Which example does this code apply to? I was previously using temporary sprites to be able to realign the frames correctly. I saw that here you are not using it. Could you please explain a little more?

  • Sorry about that R0J0hound

    I know it's confusing and I should have left an explanation.

    This is what I already solved.

    Now I need to solve these two and I'm not able to do that (the same 2xC3P layouts)

    Layout 1

    Layout 2

    C3P: we.tl/t-16w3i8PPXy

    I hope I managed to make it more understandable now. If not, please let me know. Thanks

  • Hi R0J0hound

    I tried to solve this problem but I've been stuck in this trap since Thursday.

    This is the file I'm using to test the possibilities.

    At first, I need to change the position of the letters below, according to the black numbers below (above the letters). The answer is generated before the script and available on one of the buttons with orange numbers (3 in total). Could you please check why my code is not working? Thanks.

    we.tl/t-LzcJQJ3wGP

  • for each sprite3

    pick sprite2 instance loopindex

    pick sprite1 instance sprite2.animationFrame

    -- sprite3: set frame to Sprite1.AnimationFrame

    Very nice! Thank you.

    As I only had the variable storing the numbers, I ended up generating a temporary sprite to be able to list these numbers. Curiosity: is it possible to do it with a variable instead of using the sprite frames as a reference?

    Thank you very much. Providing some coffee. ;)

    I will create some difficulty levels and I think I will be able to implement it using the solutions you gave me.

  • 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))
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

RBuster's avatar

RBuster

Early Adopter

Member since 29 Oct, 2012

Twitter
RBuster has 2 followers

Connect with RBuster

Trophy Case

  • 12-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

21/44
How to earn trophies