How do I Animation set +1

0 favourites
  • 3 posts
From the Asset Store
Ninja char for your game! Make your own Shinobi game with this art.
  • I want to use the mouse wheel and scroll up + 1 then at the end of the animation frames I want it to go back to 0

    Basically, use the Mouse wheel for scrolling through animations and loop

  • Add variable called current frame set it 0 on start. Add new event mouse -> mouse wheal down, add action to the event sprite -> set animation frame = frame(global variable), another action system -> add to -> frame -> 1.

    Also see how many frames the animation has and add event to reset the variable frame to 0, when the last frame is reached.

    You can change this event with mouse while up, and decrement the frame by -1, so with mouse while down it will scroll the animation forward, and with mouse wheal down it will decrement them.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You actually don't even need an extra variable.

    Each Sprite has its own expression [Sprite].AnimationFrame which returns the current animation frame.

    It also has the expression [Sprite].AnimationFrameCount which can come in handy.

    Now when you want to scroll through the animation frames, you can do this with one action:

    • Set animation frame to: Sprite.AnimationFrame < Sprite.AnimationFrameCount-1 ? Sprite.AnimationFrame+1 : 0

    This will include the animation frame check condition in the actual action.

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