Add more explicit control around save/load. This still seems to only work sporadically though.
This commit is contained in:
parent
06879ee1ad
commit
77f3d49ba9
|
@ -5,6 +5,7 @@ __lua__
|
||||||
#include sound.lua
|
#include sound.lua
|
||||||
#include world.lua
|
#include world.lua
|
||||||
#include player.lua
|
#include player.lua
|
||||||
|
#include savegame.lua
|
||||||
#include main.lua
|
#include main.lua
|
||||||
__gfx__
|
__gfx__
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
### 'permanent' color palette modifications
|
||||||
|
---
|
||||||
|
11 -> 139
|
||||||
|
|
||||||
|
|
||||||
### sprites
|
### sprites
|
||||||
---
|
---
|
||||||
### map tiles
|
### map tiles
|
||||||
|
|
7
main.lua
7
main.lua
|
@ -1,10 +1,15 @@
|
||||||
function _init()
|
function _init()
|
||||||
cartdata("annabunches_a_pleasant_stroll_e25d3e5c")
|
pal(11, 139, 1)
|
||||||
|
|
||||||
|
-- module inits
|
||||||
|
init_savegame""
|
||||||
init_sound""
|
init_sound""
|
||||||
init_world""
|
init_world""
|
||||||
init_player""
|
init_player""
|
||||||
init_debug""
|
init_debug""
|
||||||
|
|
||||||
|
load_game""
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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 = dget(0), dget(1)
|
player_x, player_y = 0, 0
|
||||||
|
|
||||||
facing_v = 1
|
facing_v = 1
|
||||||
facing_h = 0
|
facing_h = 0
|
||||||
|
@ -76,8 +76,6 @@ 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
|
||||||
|
|
||||||
|
|
15
savegame.lua
Normal file
15
savegame.lua
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
-- functions to save and restore cartdata
|
||||||
|
|
||||||
|
function init_savegame()
|
||||||
|
cartdata"annabunches_a_pleasant_stroll_e25d3e5c"
|
||||||
|
end
|
||||||
|
|
||||||
|
function load_game()
|
||||||
|
player_x = dget(0)
|
||||||
|
player_y = dget(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function save_game()
|
||||||
|
dset(0, player_x)
|
||||||
|
dset(1, player_y)
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user