zero-to-mastery/ZTM-Quest

Store last position of main character on map change

Closed this issue · 0 comments

Currently, if you change maps, the character gets spawned on the default spawn point which works most of the time.
But if you enter for example the arcade map, and go out of the arcade, the player gets spawned at the academy which is of course not right.
It should get spawned in front of the arcade building.

Store the last known position of the character on map change into local storage (so that it gets persisted on page refresh as well) and spawn the character always on each map at the last known position.
Keep in mind, that for page refreshes, the last known position might not be enough because a reference to last map should also exist.