diff --git a/index_map.md b/index_map.md new file mode 100644 index 0000000..da118b2 --- /dev/null +++ b/index_map.md @@ -0,0 +1,38 @@ +### sprites +--- +### map tiles +2 - grass +3 - bush +4 - tree +5 - red flowers +6 - pink flowers +7 - mushrooms +8 - big mushroom +9 - sand +10 - cactus with flower +11 - pebbles +12 - rock +13 - cactus +14 - tree stump +15 - cactus stump +16 - mushroom stump +17 - long grass + +### inventory icons +65 - wood +66 - mushroom +67 - cactus meat + +### sfx +--- +0 - noise effect for wind track (sfx 9) +1 - little bell +8 - desert music 1 +9 - desert wind +10 - desert music 2 +11 - chopping wood +12 - chopping vegetation + +### patterns +--- +0-1 - desert bgm (loops on 1) diff --git a/mapgen.lua b/mapgen.lua index 87059c6..fd693fe 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -7,20 +7,7 @@ function init_mapgen() -- Metadata for different biomes -- frequencies don't have to add up to 100, but they should by convention - -- - -- Sprites are: - -- * 2 - grass - -- * 3 - bush - -- * 4 - tree - -- * 5 - red flowers - -- * 6 - pink flowers - -- * 7 - mushrooms - -- * 8 - big mushroom - -- * 9 - sand - -- * 10 - cactus with flower - -- * 11 - pebbles - -- * 12 - rock - -- * 13 - cactus + -- tile_frequencies tuples are {frequency, sprite_index}, see index_map.md biome_data = { grassland = { biome_frequency = 75, @@ -92,17 +79,17 @@ end -- determines which biome a given world map position should be, -- returns the object out of the biome_data table -function get_biome(pos) +function get_biome_name(pos) local biome_pos = calculate_biome_pos(pos) local uid = generate_uid(biome_pos) - local biome_name = biome_metadata[(uid % #biome_metadata) + 1] - return biome_data[biome_name] + return biome_metadata[(uid % #biome_metadata) + 1] end -- determine what sprite to render for a given position. -- todo: this needs the ability to have a list of 'changed' tiles to check against. function get_tile(pos) - local biome = get_biome(pos) + local biome_name = get_biome_name(pos) + local biome = biome_data[biome_name] local uid = generate_uid(pos) return biome["tile_lookup"][(uid % #biome["tile_lookup"]) + 1] diff --git a/player.lua b/player.lua index 837f85f..361e2e5 100644 --- a/player.lua +++ b/player.lua @@ -88,6 +88,15 @@ end function draw_player() spr(player_lookup[facing[1]][facing[2]], 64, 64) -- todo: animate the character on move + + -- draw the player's HUD + if fget(mget(player_pos[1], player_pos[2]), 1) then + -- flag 1 represents an interactable (read: destructible) sprite. + -- need a map of destructible map objects, appropriate sfx, replacement + -- sprites. + end + + -- todo: introduce the concept of an inventory here end -- pos is camera position, meaning the map-relative player diff --git a/sfx_map.md b/sfx_map.md deleted file mode 100644 index 912155c..0000000 --- a/sfx_map.md +++ /dev/null @@ -1,12 +0,0 @@ -### sfx ---- -0 - noise effect for wind track (sfx 9) -1 - little bell - -8 - desert music 1 -9 - desert wind -10 - desert music 2 - -### patterns ---- -0-1 - desert bgm (loops on 1)