How do I create the following sequence/memory event?

From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi,

    I've been trying to make a game event where a character displays a random sequence of objects which the player then has to click on in the correct order, like in the sample image. Even a simple c3 file would be extremely useful if anyone has the time.

    Tagged:

  • An easy method is to use a text variable to store the sequence. For example, it can be a list of animation frames - "310". Which means that first you need to click sprite instance with frame 3, then 1, then 0.

    As player is clicking the sprites, save clicked frames in another variable:

    Set Result to (Result & Sprite.AnimationFrame)

    And once two variables are equal, this means that the sprites were clicked in the correct order.

  • Many thanks, dop2000.

  • I've run into a minor problem. How do I get a different animation to play if a sprite is clicked in the wrong order?

  • If you took my advice with two variables (correct order and clicked order), then once the length of both variables is the same, check if they are equal. If not - this means that the clicked order was wrong.

    If you want to detect mistakes immediately when the first wrong picture is clicked, you need to do something like this:

     Compare variable clickedOrder not equal left(correctOrder,len(clickedOrder))
     // display animation for wrong order
    
  • Thanks dop2000, that was just what I was looking for.

    One last question. I have a row of four instances of the same sprite. When one is touched it's destroyed and is replaced using an instance variable, but this doesn't work if the sprite is playing the different animation. How do I get it to respawn?

  • Not sure I understand the question.

    If you are spawning the same sprite, then why destroy one and create another? Simply change the animation frame on it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks dop2000, changing the frame worked. I should know better than to post when I'm tired because I overlook things like this.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)