Handling Players, enemies and attacks in HTML5
- by Chris Morris
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.