Discord
Login
Community
DARK THEME

Animation and movement

I just recently started learning microscript. I have a problem I don't know how to make animation when moving, here is my code for moving:

if keyboard.D then
  
    playerX += 5
end CurrentFrame +=
 

if keyboard.W then
    playerY += 5
    
end  CurrentFrame +=
  

if keyboard.A then
    CurrentFrame +=
    playerX -= 5
end CurrentFrame +=


if keyboard.S then
    playerY -= 5
end  

screen.drawSprite("sprite5", playerX, playerY, 64, 64)
sprites["sprite5"].setFrame(CurrentFrame)

end

The animation is played automatically by the MicroStudio engine.

See this library for playing animations

https://microstudio.dev/i/gilles/spriteanimation/

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community