Save player location on exit.
This commit is contained in:
parent
374336ee4a
commit
a2ff92cfc0
2
main.lua
2
main.lua
|
@ -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""
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user