How can I render player movement on a 2d plane efficiently?
Posted
by
user422318
on Game Development
See other posts from Game Development
or by user422318
Published on 2012-04-04T02:01:12Z
Indexed on
2012/04/04
5:41 UTC
Read the original article
Hit count: 260
I'm prototyping a 2d HTML5 game with similar interaction to Diablo II. (See an older post of mine describing the interaction here: How can I imitate interaction and movement in Diablo II?)
I just got the player click-to-move system working using the Bresenham algorithm but I can't figure out how to efficiently render the player's avatar as he moves across the screen. By the time redraw() is called, the player has already finished moving to the target point. If I try to call redraw() more frequently (based on my game timer), there's incredible system lag and I don't even see the avatar image glide across the screen.
I have a game timer based off this awesome timer class: http://www.dailycoding.com/Posts/object_oriented_programming_with_javascript__timer_class.aspx
In the future, there will be multiple enemies chasing the player. Fast pace is essential to the experience.
What should I do?
© Game Development or respective owner