Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    How to animate rpg player sprite

    Help
    2
    2
    172
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • poof92
      poof92 last edited by

      Animate when using directional buttons.

      1 Reply Last reply Reply Quote 0
      • Discostew
        Discostew F last edited by

        If you don't know how animation works with sprites, then refer to the HELP section specifically about that and relevant material - https://fuzearena.com/help/view/setSpriteAnimation

        If you do know how to animate sprites, but are looking as to how to deal with them while doing things based on actions made, like moving with the D-Pad or Analog sticks, then keep reading. What many of us utilize is a form of finite-state machine for the sprites. In a simpler explanation, your sprites maintain a "state", to which actions taken can lead to certain results. For this, using the directional buttons leads to animating a sprite with a set of movement frames. So, we need at least 2 states. One for standing still, and one for moving. When going from standing still to moving, you change the animation. Same goes from moving to standing still. But no need to change animations if going from moving to moving (unless it's in different directions), or standing to standing. So have at least a variable that represents the current state of the sprite (stand, move_left, move_right, etc), and a variable that represents the previous state of the sprite. You change the current sprite based on the action made. Then, when comparing to the previous state, you can then make the necessary changes to produce the movement animation desired. Be sure to also set the previous state equal to the current state, so you don't end up basically resetting the animation each time you do a check.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post