next fram - previous frame

Get help using Construct 2

Post » Sun May 27, 2012 9:03 pm

I swear I search in the forums and tutorials but I coudn't find the action that let me set an animation to a previous or next frame.

I'm making a prev and next buttons that, when clicked, will change the frame of an object; how can I do that?

thanks!
B
9
S
3
G
3
Posts: 39
Reputation: 3,112

Post » Sun May 27, 2012 9:10 pm

You can use the animation controls within the sprite object:

Event: On Button press -> Action: SpriteName -> Set frame (Frame number)

EDIT// On re-read, you want a function that goes to the next frame instead of a specified one? Like AS nextFrame? That one I'm not so sure, you could manually specify each frame using the set frame action, but this may not be what your afterMr E Bear2012-05-27 21:13:22
B
49
S
14
G
3
Posts: 540
Reputation: 5,611

Post » Sun May 27, 2012 9:15 pm

[QUOTE=Mr E Bear]
Event: On Button press -> Action: SpriteName -> Set frame (Frame number)[/QUOTE]

But I should cover all the posibilities in events and actions? I mean, If the object is in frame 2, the prev button should set it to 1 and the next button should set it to 3, but, if the object is in frame 3 the buttons will still work like if it was in 2.
B
9
S
3
G
3
Posts: 39
Reputation: 3,112

Post » Sun May 27, 2012 9:17 pm

[QUOTE=Mr E Bear] You can use the animation controls within the sprite object:

Event: On Button press -> Action: SpriteName -> Set frame (Frame number)

EDIT// On re-read, you want a function that goes to the next frame instead of a specified one? Like AS nextFrame? That one I'm not so sure, you could manually specify each frame using the set frame action, but this may not be what your after[/QUOTE]

jajaja, sorry, didn't saw the edition. I guess that I should set every posibilty but I'm sure there must be an easier way to do it. If it isn't I would suggest it's integration for the next launch.
B
9
S
3
G
3
Posts: 39
Reputation: 3,112

Post » Sun May 27, 2012 9:22 pm

[code]On Next pressed
-> Sprite: Set frame to (self.frame+1)%self.Animationframecount
On Prev pressed
-> Sprite: Set frame to self.frame = 0 ? self.Animationframecount-1 : self.frame-1
[/code]Should work fine
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun May 27, 2012 9:29 pm

[QUOTE=Yann] [code]On Next pressed
-> Sprite: Set frame to (self.frame+1)%self.Animationframecount
On Prev pressed
-> Sprite: Set frame to self.frame = 0 ? self.Animationframecount-1 : self.frame-1
[/code]Should work fine[/QUOTE]

I'm trying to use it but it says

"frame" is not an expression or instance variable in "Object"

Any idea?

Thanks anyway!
B
9
S
3
G
3
Posts: 39
Reputation: 3,112

Post » Sun May 27, 2012 10:34 pm

yeah it's self.AnimationFrame

you know, every object property will appear after you type 'self.' so well... you just had to pick the one which made more sense, and seriously, rtfm (:Yann2012-05-27 22:34:51
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon May 28, 2012 1:30 am

Thanks, it works perfectly.

But, let's be clear.. the manual isn't a InDeep explanation of the functions and is not even close. Lot of information that could be clearified in the manual is actually in the forums (even this simple function to prev and next an animation could be cleared out in the manual in the Animation controlling section).

Either way,I'll check it out in the future just in case.

bye
B
9
S
3
G
3
Posts: 39
Reputation: 3,112


Return to How do I....?

Who is online

Users browsing this forum: armaldio, ETgirl79 and 22 guests