diff --git a/a_pleasant_stroll.p8 b/a_pleasant_stroll.p8 index bdf65a9..1e98444 100644 --- a/a_pleasant_stroll.p8 +++ b/a_pleasant_stroll.p8 @@ -5,6 +5,7 @@ __lua__ #include sound.lua #include world.lua #include player.lua +#include savegame.lua #include main.lua __gfx__ 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000 diff --git a/index_map.md b/index_map.md index ce5a97a..4119e99 100644 --- a/index_map.md +++ b/index_map.md @@ -1,3 +1,8 @@ +### 'permanent' color palette modifications +--- +11 -> 139 + + ### sprites --- ### map tiles diff --git a/main.lua b/main.lua index 71a5df9..078e530 100644 --- a/main.lua +++ b/main.lua @@ -1,10 +1,15 @@ function _init() - cartdata("annabunches_a_pleasant_stroll_e25d3e5c") + pal(11, 139, 1) + -- module inits + init_savegame"" init_sound"" init_world"" init_player"" init_debug"" + + load_game"" + end diff --git a/player.lua b/player.lua index 114b4c3..f8291b0 100644 --- a/player.lua +++ b/player.lua @@ -14,7 +14,7 @@ -- draw_player() # call in _draw(). Draws the player sprite. function init_player() - player_x, player_y = dget(0), dget(1) + player_x, player_y = 0, 0 facing_v = 1 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 if legal_move(new_x, new_y) then player_x, player_y = new_x, new_y - dset(0, player_x) - dset(1, player_y) end end diff --git a/savegame.lua b/savegame.lua new file mode 100644 index 0000000..3d37d86 --- /dev/null +++ b/savegame.lua @@ -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