DEV Community

Moving a Sprite Sheet Character with JavaScript

Martin Himmel on February 25, 2019

The long overdue follow up is finally here! 😅 In part 1, we covered how to animate a sprite sheet character on a timer using requestAnimationFrame...
Collapse
 
ggenya132 profile image
Eugene Vedensky • Edited

So, basically, game development is incredibly laborious and every frame of movement is a small labor of love, got it!

But this is quite wonderful, thank you for sharing.

Collapse
 
feddorra profile image
Serhii Fedorenko

Thanks for your tutorial. This is really helpful!

Collapse
 
leosidebo profile image
leosidebo

Very helpful.

Collapse
 
nickschmitt profile image
stoicassistant

One of the best tutorials I've ever seen on dev.to.

Collapse
 
owmince1 profile image
Owmince

Hey what about diagonal move speed ? it's too fast

Collapse
 
martyhimmel profile image
Martin Himmel

The speed should be the same as the horizontal and vertical movements. If you need to slow it down, though, you could add a conditional multiplier so that when there's both horizontal and vertical movement, multiply the speed by 0.8 (or whatever you need).

Collapse
 
bradzo profile image
bradzo

Hi Martin
Good job!
Have you heard of the Phaser framework?
phaser.io

Collapse
 
martyhimmel profile image
Martin Himmel

Thanks!

Yeah, I used Phaser for a game prototype a couple years ago. It's a great framework - one I highly recommend for anyone looking to build a game in JS and not wanting to start from scratch.

Collapse
 
whity profile image
Michal Bílý

Nice way, helpful. Thanks.