Can't properly detect when animation is over...

Not favoritedFavorited Favorited 0 favourites
  • 2 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • I can usually get enough AI help that I don't need to rely on this forum all the time, but here's another issue that I can't get working, and the AIs are no help at all:

    Quickly, here is the intended behavior:

    1. The player clicks on a key card (fam_cards.cardType = "key")

    2. The key flies to the jail card (fam_cards.cardtype = "jail")

    3. Animate the jail card to look like the cell is opening

    4. When the animation is finished (frame tag = "done") start a tween (animateCard) to fade the jail card

    5. After the jail card fades out, run some JS code and enable a group

    What keeps happening:

    I can click on the key card and it will correctly fly to the jail card and start the jail card animation. When the animation finishes, nothing happens.

    I had similar events before turning to AI. Here is its suggestion:

    // 1) Key lands → open the jail (what you already have)
    spr_key: On Tween "moveKey" finished
     → spr_key: Destroy
     → System: Pick fam_cards where fam_cards.cardType = "jail"
     → fam_cards: Set animation speed to 8
     → fam_cards: Start animation from current frame
    
    // 2) As soon as that jail hits the “done” tag, fire the fade **once**
    fam_cards: On animation frame tag "done"
     System: Trigger once
     → fam_cards: Tween "animateCard" property Opacity to 0 in 3 seconds
     (In Out Sinusoidal, destroy: Yes, loop: No, ping pong: No, repeat count: 1)
    
    // 3) When the fade really does finish, run your JS + re-activate group
    fam_cards: On Tween "animateCard" finished
     → Run JavaScript: removeCardIDs(runtime)
     → System: Set group "Face Up or Down" Activated
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • fam_cards: On animation frame tag "done"

    System: Trigger once

    Why don't you use "On animation finished" condition?

    Also, I've probably mentioned this a thousand times on this forum - never use "Trigger once" with objects that have multiple instances! That's likely the reason why your code doesn't work.

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)