Access Frame Number of an Animation

0 favourites
  • 3 posts
From the Asset Store
three fully animated characters ideal for your RPG side scroller projects
  • Is it possible to access the internal frame number of the animation? Animation is on 0, 1, 2, 3rd frame etc.

    I did some Google searches, but nothing really came up.

    I needed to do something so it was pretty easy with a global variable and breaking up the animation into individual frames.

    It works. Not sure if that's the best, most efficient, or the only way to keep track of frame numbers of a specific animation for conditions.

    I've see people adding frame number as an instance variable when working with a sprite strip and a mask, but it's not something that would work for me here.

  • You can get the animation frame number easily (there's an action which returns the current AnimationFrame) but I'm tired so I'm probably missing what you're wanting to do. What are you trying to do with it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, hi there.

    Basically, I was just doing a ship tilting animation when pressing arrow keys left and right and I wanted it to animate back when the arrow key was released. I coded something with variables that works flawlessly while breaking up the 29 total frame animation into individual frames linked up to a specific variable (my way of keeping track of the frame number).

    I decided that the default standing still animation was too boring, so I also decided I would have the ship rocking back and forth by itself in the default position once it animated back to default. That's where my logic got a bit hung up. I'm pretty sure now that with this sort of scenario you can only have 2 logical conditions: key pressed and key released, so I gotta add the default rocking animation to the key released logic. That's when I got hung up on an infinite loop (since I've never done one), but someone posted a solution already, so I'll give that a try today.

    P.S. I found that working out the logic with Excel and then just coding with text objects works great.

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