Change animation frame by pressing a button

Get help using Construct 2

Post » Tue Nov 05, 2013 8:09 pm

Hello guys,

I came to a problem that I thought would be one of the easiest things. I have a menu. It consists of a background sprite on a locked background layer and an other sprite with 3 frames, each has one of the menu buttons highlighted. This sprite is on the top layer. I would like to make it work like this: when I press the down button, it jumps to the next frame on the sprite with the button highlights, when I press the up button it jumps to the previous.

It doesn't work. I use events like on the picture below. My background sprite is animated, but the one that has the highlighted menu button frames is not. I've added the keyboard to the project. I thought the problem could be because I haven't set which animation to choose, but that sprite only has one.

Twyzer2013-11-05 20:12:03
B
5
Posts: 19
Reputation: 265

Post » Tue Nov 05, 2013 8:32 pm

see if the mainmenu_items object have the animation speed set to 0
B
48
S
5
G
6
Posts: 210
Reputation: 6,297

Post » Tue Nov 05, 2013 8:37 pm

Yes it does.
B
5
Posts: 19
Reputation: 265

Post » Tue Nov 05, 2013 9:03 pm

can you post a .cap?
B
48
S
5
G
6
Posts: 210
Reputation: 6,297

Post » Tue Nov 05, 2013 9:15 pm

Sorry, I cannot post links yet.Twyzer2013-11-05 21:17:52
B
5
Posts: 19
Reputation: 265

Post » Tue Nov 05, 2013 9:27 pm

well, is hard to say without a closer look

but i think is something with you object animation, see if the frames are correct, if there is a animation (sometimes we copy the same frame by mistake), see if the animation start with frame 0 on the properties of the object and check if there is no other event blocking this action.
B
48
S
5
G
6
Posts: 210
Reputation: 6,297

Post » Tue Nov 05, 2013 9:39 pm

Finally found the problem. I had three of this event, obviously for all three menu items to step to the next upon pressing the down key. When I removed the last two it worked well. When I removed only the last event (which supposed to jump from the third to the first button upon pressing the key) and ran the program it jumped instantly to the last menu button thus skipping the middle.

I think the source of the problem might be that the program runs the events instantly and jumps through all the menu items on one single press.
B
5
Posts: 19
Reputation: 265

Post » Tue Nov 05, 2013 9:56 pm

yes, you have to keep in mind that the events need to be a sequence sometimes
B
48
S
5
G
6
Posts: 210
Reputation: 6,297

Post » Tue Nov 05, 2013 10:06 pm

Seems to work this way.

Twyzer2013-11-05 22:06:52
B
5
Posts: 19
Reputation: 265

Post » Wed Nov 06, 2013 12:49 am

Yeah, i use same way. I kind of understand why it works, but don't know how to explain it XD Not sure if it's the right way too and will not introduce some lags in the long run.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests