0 Favourites

issue with variables and animations

This forum is currently in read-only mode.
  • 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

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

    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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
1,941 263,386
FlyingRam's avatar
FlyingRam
Unread hot topic
300 118,434
blackhornet's avatar
blackhornet
Unread hot topic
0 Favourites
Spam issue
201 16,841
Tom's avatar
Tom Construct Team Founder