floors 1-3 done, floors 4-5 wip

This commit is contained in:
makiki 2024-08-17 23:21:09 +02:00
parent 5b4bd3c41c
commit 3f52c430f1
4 changed files with 314 additions and 67 deletions

View File

@ -26,10 +26,10 @@ local held_spr = {
function Game.new()
local self = {
player_power = 5,
player_x = 8,
player_y = 15,
player_x = 1,
player_y = 8,
player_item = nil,
floor = 1,
floor = 4,
level_data = LevelData:new(),
undo_history = {},
}
@ -320,19 +320,19 @@ function Game:draw()
for y=1,15 do
if walls[y][x]==2 then
love.graphics.setColor(1,1,1,1)
elseif walls[y][x]==1 and (x+y+self.floor)%2==0 then
love.graphics.setColor(0.85,0.85,0.85,1)
elseif walls[y][x]==1 then
love.graphics.setColor(0.95,0.95,0.95,1)
elseif (x+y+self.floor)%2==0 then
love.graphics.setColor(0.05,0.05,0.05,1)
love.graphics.setColor(0.85,0.85,0.85,1)
else
love.graphics.setColor(0.15,0.15,0.15,1)
love.graphics.setColor(0.05,0.05,0.05,1)
end
love.graphics.rectangle("fill",x*16-12,y*16-12,16,16)
if walls[y][x]==2 then
love.graphics.setColor(0,0,0,1)
love.graphics.rectangle("fill",x*16-10,y*16-10,2,2)
love.graphics.rectangle("fill",x*16-5,y*16-10,2,2)
love.graphics.rectangle("fill",x*16-10,y*16-5,2,2)
love.graphics.rectangle("fill",x*16-5,y*16,2,2)
love.graphics.rectangle("fill",x*16,y*16-5,2,2)
love.graphics.rectangle("fill",x*16-10,y*16,2,2)
love.graphics.rectangle("fill",x*16,y*16-10,2,2)
love.graphics.rectangle("fill",x*16,y*16,2,2)
@ -340,7 +340,7 @@ function Game:draw()
end
end
--entities
--entity sprites
love.graphics.setFont(FONT_DIGITS)
local entities = self.level_data[self.floor].entities
for i=1,#entities do
@ -348,7 +348,14 @@ function Game:draw()
--sprite
love.graphics.setColor(1,1,1,1)
love.graphics.draw(ent_spr[entities[i].type],entities[i].x*16-12,entities[i].y*16-12)
--value
end
end
--entity values
love.graphics.setFont(FONT_DIGITS)
local entities = self.level_data[self.floor].entities
for i=1,#entities do
if entities[i].type then
if entities[i].value_str then
love.graphics.setColor(0,0,0,1)
love.graphics.printf(entities[i].value_str,entities[i].x*16-10,entities[i].y*16-1,16,"right")
@ -383,7 +390,8 @@ function Game:draw()
love.graphics.rectangle("line",textboxes[i].x-1,textboxes[i].y-1,textboxes[i].w+2,textboxes[i].h+2)
love.graphics.printf(
textboxes[i].str,
textboxes[i].x+1,textboxes[i].y+1,textboxes[i].w-2
textboxes[i].x+1,textboxes[i].y+1,textboxes[i].w-2,
"center"
)
end

View File

@ -6,75 +6,314 @@ function LevelData.new()
local self = {
{ --floor 1
walls = {
{0,0,0,0,0,1,2,2,2,1,0,0,0,0,0},
{0,0,0,0,0,0,2,0,2,0,0,0,0,0,0},
{1,1,1,1,1,0,2,0,2,0,1,1,1,1,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,2,2,2},
{0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,2,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{0,1,0,0,1,1,1,0,1,1,1,0,0,1,0},
{1,1,1,0,2,0,2,0,2,0,2,0,1,1,1},
{2,2,1,0,0,0,0,0,0,0,0,0,1,2,2},
{0,0,0,0,1,0,2,1,2,0,1,0,0,0,0},
{2,2,1,0,0,0,0,0,0,0,0,0,1,2,2},
{1,1,1,0,2,0,2,0,2,0,2,0,1,1,1},
{0,1,0,0,1,1,1,0,1,1,1,0,0,1,0},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
},
entities = {
{type = "enemy", x = 1, y = 1, value_str = "1"},
{type = "enemy", x = 2, y = 1, value_str = "2"},
{type = "enemy", x = 3, y = 1, value_str = "3"},
{type = "enemy", x = 4, y = 1, value_str = "4"},
{type = "enemy", x = 5, y = 1, value_str = "5"},
{type = "enemy_neg", x = 11, y = 1, value_str = "1"},
{type = "enemy_neg", x = 12, y = 1, value_str = "2"},
{type = "enemy_neg", x = 13, y = 1, value_str = "3"},
{type = "enemy_neg", x = 14, y = 1, value_str = "4"},
{type = "enemy_neg", x = 15, y = 1, value_str = "5"},
{type = "enemy", x = 3, y = 8, value_str="2"},
{type = "enemy", x = 3, y = 5, value_str="2"},
{type = "enemy", x = 3, y = 11, value_str="2"},
{type = "enemy", x = 6, y = 6, value_str="5"},
{type = "enemy", x = 6, y = 10, value_str="5"},
{type = "enemy", x = 10, y = 6, value_str="5"},
{type = "enemy", x = 10, y = 10, value_str="5"},
{type = "enemy", x = 8, y = 5, value_str="10"},
{type = "enemy", x = 8, y = 11, value_str="10"},
{type = "enemy", x = 8, y = 7, value_str="25"},
{type = "enemy", x = 8, y = 9, value_str="25"},
{type = "enemy", x = 5, y = 7, value_str="10"},
{type = "enemy", x = 5, y = 9, value_str="10"},
{type = "enemy", x = 11, y = 7, value_str="60"},
{type = "enemy", x = 11, y = 9, value_str="60"},
{type = "enemy", x = 13, y = 5, value_str="2"},
{type = "enemy", x = 13, y = 11, value_str="2"},
{type = "enemy", x = 13, y = 8, value_str="100"},
{type = "enemy", x = 14, y = 8, value_str="250"},
{type = "elixir", x = 14, y = 14},
{type = "elixir", x = 14, y = 15},
{type = "elixir", x = 15, y = 14},
{type = "elixir", x = 15, y = 15},
-- TODO: decide on the value of these bonus enemies
{type = "enemy", x = 1, y = 5, value_str="1k"},
{type = "enemy", x = 1, y = 11, value_str="1k"},
{type = "enemy", x = 15, y = 5, value_str="1k"},
{type = "enemy", x = 15, y = 11, value_str="1k"},
{type = "stairs_up", x = 8, y = 2},
{type = "gate", x = 8, y = 3},
{type = "stairs_up", x = 15, y = 8},
},
textboxes = {
{
x = 10, y = 80,
w = 80, h = 36,
str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi quis pretium ante, et consequat quam.",
}
x = 8, y = 8,
w = 232, h = 40,
str = "Welcome to the Tower of Scale! Use arrow keys to move. WASD, vikeys and numpad will also work.",
},
{
x = 8, y = 200,
w = 232, h = 40,
str = "You can defeat enemies with lower power by moving into them. If you do this, you absorb their power and add it to yours.",
},
}
},
{ --floor 2
walls = {
{0,0,0,0,0,0,2,2,2,0,0,0,0,0,0},
{0,0,0,0,0,0,2,0,2,0,0,0,0,0,0},
{0,0,0,0,0,0,2,0,2,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{2,2,2,0,0,0,0,0,0,0,0,0,2,2,2},
{2,1,2,0,0,0,0,0,0,0,0,0,2,1,2},
{2,2,2,0,0,0,0,0,0,0,0,0,2,2,2},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{0,0,0,0,0,0,2,0,0,1,0,0,0,0,0},
{0,0,2,0,0,0,2,2,2,2,0,1,1,1,0},
{2,2,2,0,1,1,0,2,0,0,0,0,0,2,0},
{0,2,0,0,2,1,0,0,0,1,2,0,0,2,0},
{0,2,0,0,0,0,0,2,0,1,1,0,2,2,2},
{0,1,1,1,0,2,2,2,2,0,0,0,2,0,0},
{0,0,0,0,0,1,0,0,2,0,0,0,0,0,0},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
},
entities = {
{type = "vorpal", x = 4, y = 8},
{type = "pickaxe", x = 12, y = 8},
{type = "enemy", x = 10, y = 7, value_str="250"},
{type = "enemy", x = 6, y = 9, value_str="250"},
{type = "stairs_down", x = 8, y = 2},
{type = "enemy", x = 1, y = 5, value_str="30"},
{type = "enemy", x = 2, y = 5, value_str="25"},
{type = "enemy", x = 1, y = 6, value_str="25"},
{type = "enemy", x = 2, y = 6, value_str="25"},
{type = "enemy", x = 5, y = 5, value_str="15"},
{type = "enemy", x = 6, y = 5, value_str="15"},
{type = "enemy", x = 5, y = 6, value_str="15"},
{type = "enemy", x = 6, y = 6, value_str="15"},
{type = "enemy", x = 14, y = 11, value_str="25"},
{type = "enemy", x = 15, y = 11, value_str="30"},
{type = "enemy", x = 14, y = 10, value_str="25"},
{type = "enemy", x = 15, y = 10, value_str="25"},
{type = "enemy", x = 10, y = 11, value_str="15"},
{type = "enemy", x = 11, y = 11, value_str="15"},
{type = "enemy", x = 10, y = 10, value_str="15"},
{type = "enemy", x = 11, y = 10, value_str="15"},
{type = "enemy", x = 3, y = 8, value_str="7"},
{type = "enemy", x = 3, y = 9, value_str="7"},
{type = "enemy", x = 13, y = 8, value_str="7"},
{type = "enemy", x = 13, y = 7, value_str="7"},
{type = "enemy", x = 8, y = 11, value_str="250"},
{type = "enemy", x = 8, y = 5, value_str="250"},
{type = "gate", x = 15, y = 7},
{type = "gate", x = 1, y = 9},
{type = "gate", x = 8, y = 8},
{type = "gate", x = 9, y = 5},
{type = "gate", x = 7, y = 11},
{type = "gate", x = 3, y = 5},
{type = "gate", x = 13, y = 11},
{type = "stairs_down", x = 15, y = 8},
{type = "stairs_up", x = 1, y = 8},
},
textboxes = {}
textboxes = {
{
x = 8, y = 8,
w = 232, h = 40,
str = "Division Gates will divide your power by two. Try to open them while your power is low, to reduce your losses.",
},
{
x = 8, y = 205,
w = 232, h = 30,
str = "Whenever you feel like you've made a mistake, don't be afraid to undo by pressing the Z key.",
},
}
},
{ --floor 3
walls = {
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,2,2,2,1,1,1,1,1,2,2,2,1,1},
{2,2,2,0,2,2,2,1,2,2,2,0,2,2,2},
{0,0,0,0,0,0,2,2,2,0,0,0,1,2,0},
{0,1,0,2,2,0,0,1,0,0,0,2,1,2,0},
{1,1,0,0,0,0,0,0,0,1,0,0,0,1,1},
{0,0,0,2,2,0,0,1,0,0,0,2,1,2,2},
{0,0,0,0,0,0,2,2,2,0,0,0,1,0,0},
{2,2,2,2,2,2,2,1,2,2,2,2,2,2,2},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
},
entities = {
{type = "enemy", x = 15, y = 8, value_str="25G"},
{type = "enemy", x = 8, y = 9, value_str="3k"},
{type = "enemy", x = 1, y = 10, value_str="100"},
{type = "enemy", x = 2, y = 10, value_str="100"},
{type = "enemy", x = 2, y = 11, value_str="250"},
{type = "enemy", x = 4, y = 9, value_str="10"},
{type = "enemy", x = 5, y = 9, value_str="10"},
{type = "enemy", x = 4, y = 11, value_str="10"},
{type = "enemy", x = 5, y = 11, value_str="10"},
{type = "enemy", x = 10, y = 8, value_str="500"},
{type = "enemy", x = 10, y = 10, value_str="500"},
{type = "pickaxe", x = 4, y = 6},
{type = "pickaxe", x = 14, y = 11},
{type = "pickaxe", x = 15, y = 11},
{type = "pickaxe", x = 13, y = 9},
{type = "pickaxe", x = 1, y = 11},
{type = "vorpal", x = 12, y = 6},
{type = "stairs_down", x = 1, y = 8},
{type = "stairs_up", x = 15, y = 7},
},
textboxes = {
{
x = 9, y = 7,
w = 111, h = 58,
str = "You can use a pickaxe to destroy a single non-reinforced wall.",
},
{
x = 128, y = 7,
w = 111, h = 58,
str = "You can use a vorpal blade to kill any enemy once, but you won't absorb their power.",
},
{
x = 8, y = 205,
w = 232, h = 30,
str = "Be aware that you can only hold a single pickaxe or a single vorpal blade.",
},
}
},
{ --floor 4
walls = {
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{2,0,2,2,1,1,1,1,1,1,1,2,2,0,2},
{0,0,2,2,0,0,0,0,0,0,0,2,2,0,0},
{0,0,0,0,0,2,0,2,0,2,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,0,0,2,2,2,0,2,2,2,0,0,1,1},
{0,0,0,0,2,0,0,0,0,0,2,0,0,0,0},
{1,1,0,0,0,0,1,1,1,0,0,0,0,1,1},
{0,0,0,0,2,0,1,0,1,0,2,0,0,0,0},
},
entities = {
{type = "enemy_neg", x = 13, y = 7, value_str = "5k"},
{type = "enemy_neg", x = 3, y = 7, value_str = "5k"},
{type = "enemy_neg", x = 2, y = 8, value_str = "1k"},
{type = "enemy_neg", x = 14, y = 8, value_str = "1k"},
{type = "enemy_neg", x = 5, y = 9, value_str = "1k"},
{type = "enemy", x = 6, y = 9, value_str = "500"},
{type = "enemy_neg", x = 7, y = 9, value_str = "1k"},
{type = "enemy", x = 8, y = 9, value_str = "500"},
{type = "enemy_neg", x = 9, y = 9, value_str = "1k"},
{type = "enemy", x = 10, y = 9, value_str = "500"},
{type = "enemy_neg", x = 11, y = 9, value_str = "1k"},
{type = "enemy", x = 1, y = 15, value_str = "500"},
{type = "enemy_neg", x = 2, y = 15, value_str = "500"},
{type = "enemy", x = 15, y = 15, value_str = "500"},
{type = "enemy_neg", x = 14, y = 15, value_str = "500"},
{type = "enemy", x = 1, y = 13, value_str = "250"},
{type = "enemy_neg", x = 2, y = 13, value_str = "250"},
{type = "enemy", x = 15, y = 13, value_str = "250"},
{type = "enemy_neg", x = 14, y = 13, value_str = "250"},
{type = "enemy", x = 6, y = 15, value_str = "50"},
{type = "enemy", x = 6, y = 14, value_str = "50"},
{type = "enemy", x = 6, y = 13, value_str = "50"},
{type = "enemy", x = 7, y = 13, value_str = "50"},
{type = "enemy", x = 8, y = 13, value_str = "50"},
{type = "enemy", x = 9, y = 13, value_str = "50"},
{type = "enemy", x = 10, y = 13, value_str = "50"},
{type = "enemy", x = 10, y = 14, value_str = "50"},
{type = "enemy", x = 10, y = 15, value_str = "50"},
{type = "enemy_neg", x = 8, y = 11, value_str = "1k"},
{type = "gate", x = 5, y = 14},
{type = "gate", x = 11, y = 14},
{type = "gate", x = 8, y = 12},
{type = "enemy", x = 8, y = 15, value_str = "3k"},
{type = "pickaxe", x = 6, y = 7},
{type = "pickaxe", x = 7, y = 7},
{type = "vorpal", x = 8, y = 7},
{type = "pickaxe", x = 9, y = 7},
{type = "pickaxe", x = 10, y = 7},
{type = "stairs_up", x = 1, y = 7},
{type = "stairs_down", x = 15, y = 7},
},
textboxes = {
{
x = 8, y = 15,
w = 232, h = 57,
str = "Negative enemies work the same as normal enemies, with one difference - when you absorb their power, you substract their power from yours instead of adding it.",
},
}
},
{ --floor 5
walls = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,2,2,2,2,2,2,2,2,2,2,2,2},
{1,1,1,2,1,1,1,1,1,1,1,1,1,1,1},
{1,0,1,2,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,2,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,2,1,1,1,1,1,1,1,1,1,1,1},
},
entities = {
{type = "elixir", x = 2, y = 13},
{type = "stairs_down", x = 1, y = 7},
{type = "stairs_up", x = 15, y = 7},
},
textboxes = {
{
x = 72, y = 188,
w = 168, h = 49,
str = "Elixirs will double your power. Try to save them until your power is high to maximize the gains.",
},
}
},
}

View File

@ -40,7 +40,7 @@ function love.draw()
local w, h = love.graphics.getWidth(), love.graphics.getHeight()
local s = math.min(w/BASE_RES_W,h/BASE_RES_H)
local s = math.floor(s)
love.graphics.translate((w-BASE_RES_W*s)/2,(h-BASE_RES_H*s)/2)
love.graphics.translate(math.floor((w-BASE_RES_W*s)/2),math.floor((h-BASE_RES_H*s)/2))
love.graphics.scale(s, s)
love.graphics.clear()
love.graphics.draw(main_canvas)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB