Save player location to cartdata

This commit is contained in:
Anna Rose 2019-12-11 02:13:11 -05:00
parent 374336ee4a
commit b8c9b36b0b
2 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,6 @@
function _init() function _init()
cartdata("annabunches_a_pleasant_stroll_e25d3e5c")
init_sound"" init_sound""
init_world"" init_world""
init_player"" init_player""

View File

@ -14,7 +14,7 @@
-- draw_player() # call in _draw(). Draws the player sprite. -- draw_player() # call in _draw(). Draws the player sprite.
function init_player() function init_player()
player_x, player_y = 0, 0 player_x, player_y = dget(0), dget(1)
facing_v = 1 facing_v = 1
facing_h = 0 facing_h = 0
@ -76,6 +76,8 @@ function handle_input()
-- note that facing always changes, even if we can't move to the new location -- note that facing always changes, even if we can't move to the new location
if legal_move(new_x, new_y) then if legal_move(new_x, new_y) then
player_x, player_y = new_x, new_y player_x, player_y = new_x, new_y
dset(0, player_x)
dset(1, player_y)
end end
end end