Changing Avatar Image

  1. Prepare a sample sprite sheet with the animation. If you do not have one, please download the image below.

triangle-exclamation

2. As seen in the image above, single frames of the same size are aligned in each frame into a sprite sheet image. The file extension must be a PNG file.

  • TIP : For avatars, we recommend the following frame size of 48(px) x 64(px) for each action frame.

circle-check

3. Load a sprite sheet by using the following App.loadSpritesheet API.

  • First Argument(fileName): Adds the file extension in the name of the sprite sheet

  • Second Argument(frameWidth): Width of one action frame size (px)

  • Third Argument(frameHeight): Height of one action frame size (px)

  • Fourth Argument(anims): Animation name determined in ZEP (left, right, up, down) and numbers of each image index

circle-check
  • Fifth Argument(frameRate): Determine how many frames will repeat within 1 second.

4. player.sendUpdated() needs to be written to apply the player’s attribute change

5. Example Code

6. Usage

circle-check
circle-exclamation

Last updated

Was this helpful?