Handling Players, enemies and attacks in HTML5
Posted
by
Chris Morris
on Game Development
See other posts from Game Development
or by Chris Morris
Published on 2013-06-28T10:34:07Z
Indexed on
2013/06/28
16:31 UTC
Read the original article
Hit count: 339
I'm building a simple (currently) game with free roaming player and monsters on a map built by a 2D grid.
I've been looking at the methods for implementing characters and enemies onto the screen and I've seen two seperate methods for doing this online.
- Drawing the player onto the screen canvas directly and refreshing the entire screen every FPS tick.
- Having a separate canvas to handle the player and moving the player canvas on top of the screen canvas via absolute positioning.
I can see some pros and cons of both methods but what is generally the best method for doing this? I assume the second due to not having to drain resources by refreshing the map when the user is not moving, but the type of game will generally have constant movement.
© Game Development or respective owner