Set current animation frame to +-1

  • How do I setup a sprite with a single animation that's going to change frames, previous or next, by one frame when a key is pressed?

  • Put a "Compare frame" event as a sub-event of your "On key pressed" event, set the frame to 1 if the frame is currently 0. Then add an "Else" event (press x) and set the frame to 0 in the in that event.

  • OK, now I can go back between two frames but I've got 183 of them. Is their a way to say set current animation frame to current animation frame + 1?

  • Sure, just use "Sprite.Animationframe+1" when setting the frame.

    I just realized that's what you really wanted, sorry for the misunderstanding! <img src="smileys/smiley17.gif" border="0" align="middle" />

    Edit: Oh, and if you want to do either +1 or -1 randomly, you can use the choose expression "Sprite.Animationframe+int(choose(-1, 1))"

  • Awesome it works now, thanks!

    Ive got a lot of other questions I wanna ask, should I start up another topic for each(if I can't find one), or a general topic? Is their a chatroom to ask questions? I noticed the current one isn't working.

    Again Thanks!

  • Depends, if it's a similar question you can just post within the same topic. There's an IRC chat room, you can connect with an IRC client, or through Mibbit with the "Chat!" link in the menu. The "Chat Beta" is part of the forum and doesn't really work, like you saw.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "Sprite.AnimationFrame+1 %Sprite.animationFrameCount" To make it loop back round to 0

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