How can I imitate interaction and movement in Diablo II?
- by user422318
I'm prototyping a simple browser-based game. It's played from a top down perspective on a 2d canvas.
You left-click on a point on the map, and your character will begin walking to it. If you click on a different point on the map, then your character will begin walking to the new point.
It's similar to Diablo II: http://www.youtube.com/watch?v=EvDKt-To6K0&feature=related
How can I best imitate this movement system for a player? Ideas...
Track current coords and target coords
If target coords are exactly up, left, right, or down, then increment appropriate direction until you get there
Implied else: target coords are in a quadrant. To make this movement look natural, character will have to move diagonally. For example, pretend the target is to the northeast. For each game frame, alternate incrementing current coordinates in the north and then east directions.