issue with variables and animations

For questions about using Classic.

Post » Fri Jul 16, 2010 5:27 pm

I've got one global variable 'door' to controll animations for opening/closing doors

+ 'door' = 0
-> set animation to "idle"
+ 'door' = 1
-> set animation to "idle2"
+ 'door' = 2
-> set animation to "open"
-> set animation frame to 1
-> play animation
+ 'door' = 3
-> set animation to "close"
-> set animation frame to 1
-> play animation

for 0 and 1 is fine couse it's only 1 frame long animations, but for 2 and 3 it only plays first frames of their animations...
but if you add one more value, so 'door's = 4 it starts to play "close" animation from 'door'=3

am i missing something in that code?

Here's the file: door.cap
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Fri Jul 16, 2010 7:04 pm

Add a "Trigger Once" condition to the global variable comparison events so the actions a done only once when true. As it is now, every tick sets the animation so the the multiframe animation don't get a chance to play.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Fri Jul 16, 2010 7:32 pm

actually i just solved that heh :)
I've changed values from 0,1,2,3 to 1,2,3,4 and then
+ 'door' = 3
-> set animation to 'open'
-> set animation frame to 1
-> play animation
-> set 'door' to 0

it play's animation normally now, and helps me with other things :)

[quote:wug98lep]As it is now, every tick sets the animation so the the multiframe animation don't get a chance to play.[/quote:wug98lep]

eh, never though about that, but now i can see a point in that.
if 'door' = 3 -> set frame to 1 -> play animation
Construct will loop that sequence every tick so only frame 1 will be played all over again - it's so obvious ;)

thanks for that tip R0J0hound
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests