Change frame with object overlapping

Get help using Construct 2

Post » Sun Aug 04, 2013 12:29 pm

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:

CONDITIONS=
1) Keyboard > On "+" pressed
2) "Cursor" overlapping "Cube"
3) "Cube" animation frame = 0 (wich is number 1)

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


------------------------------------------------------

CONDITIONS=
1) Keyboard > On "+" pressed
2) "Cursor" overlapping "Cube"
3) "Cube" animation frame = 1 (wich is number 2)

ACTION=
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. ikarus2013-08-04 12:30:48
B
9
S
1
Posts: 13
Reputation: 499

Post » Sun Aug 04, 2013 1:37 pm

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. GenkiGenga2013-08-04 13:40:15
ImageImage
B
102
S
21
G
6
Posts: 1,058
Reputation: 11,825

Post » Sun Aug 04, 2013 3:46 pm

Thank you very much for your help, GenkiGenga. I'll try the way you told me and I'll post it.
B
9
S
1
Posts: 13
Reputation: 499

Post » Sun Aug 04, 2013 5:50 pm

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.
B
43
S
12
G
6
Posts: 446
Reputation: 6,797

Post » Mon Aug 05, 2013 8:47 am

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.
B
9
S
1
Posts: 13
Reputation: 499


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, ismael123, lennaert, plinkie and 6 guests