RBuster's Recent Forum Activity

  • I thought to use something like this:

  • Thank you so much R0J0hound

    I thought you wouldn't have time so soon and I ended up trying hard to get this problem resolved so I could proceed. I managed to do this last night, but I'll take a look at your file to see if I can optimize my solution. It will definitely be much better than mine.

    I'm having a problem finding a solution for another question and I think you can help me (if it's not asking too much)

    The exercise has 3 answer options. I would like to make one of them (randomly) receive the value of the right answer signed in a variable (eg: varAnswer=0,3,2,1) and the other two options would have to be randomized to generate other different combinations between them. In the end, I need to know which of the options was signed as right, that is, the one that has the value of the varAnswer variable. Could you give me an idea of how to build this? It can be in pseudocode even if you prefer.

    EDITED: I am still talking about the same game, where each answer option consists of 4 numbers. Just to clarify.

  • I forgot about the "current frame" option. This is exactly what I need. Thanks!

  • 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?

  • Try Construct 3

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

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

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