0 Favourites

Change frame with object overlapping

  • Hi there,

    This is my first in-game question but i'm getting crazy and didn't find any solution.

    I'm making a puzzle game where there are some cubes with different numbers inside (from 1 to 10). There is also a cursor that you can move over the cubes, and pressing a key you can change the number inside (one number up or down).

    I have an object for the cube with ten frames inside (one for each number from 1 to 10). I created two events to try:


    1) Keyboard > On "+" pressed

    2) "Cursor" overlapping "Cube"

    3) "Cube" animation frame = 0 (wich is number 1)


    1) "Cube" Set animation frame to 1 (wich is number 2)



    1) Keyboard > On "+" pressed

    2) "Cursor" overlapping "Cube"

    3) "Cube" animation frame = 1 (wich is number 2)


    1) "Cube" Set animation frame to 2 (wich is number 3)


    Well, I don't understand why when I run the game and press the "+" key over the cube with number 1, it turns to number 3 instead of 2. In fact, if I keep making the sequence of events for all numbers until 10, if I press the "+" key, it turns directly to 10. Why??

    Of course, the animation speed of the object is set to 0.

    I hope you can help me. I've searched in the tutorials but didn't find any solution for this.

    Thanks in advance.

  • Hey Ikarus,

    Remember that the event sheet runs top down, the first event runs but then also sets it to activate the second. You can code it a different way or simply flip them upside down to make it work (from highest to lowest instead of lowest to highest). So when you click it will look for animation frame 2 first and not activate it again.

    Hope that made sense lol.

  • Thank you very much for your help, GenkiGenga. I'll try the way you told me and I'll post it.

  • Also, try to make it so it "adds 1" instead of manually adding one for each number. will be literally 10 times shorter =)

    Besides, that way it can't accidentally trigger twice.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Well, I tried what Genki said and it works. Now I have to find out how to make it in one event, not in ten! Don't tell me it. I have to discover for myself.

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