From 5b4bd3c41c09fc0544d40dfa547ca198de316a01 Mon Sep 17 00:00:00 2001 From: makiki Date: Sat, 17 Aug 2024 19:25:59 +0200 Subject: [PATCH] textboxes --- game.lua | 13 +++++++++++++ leveldata.lua | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/game.lua b/game.lua index 0647e62..c9b5e40 100644 --- a/game.lua +++ b/game.lua @@ -374,6 +374,19 @@ function Game:draw() love.graphics.setFont(FONT_STANDARD) love.graphics.print("FLOOR "..(self.floor>9 and self.floor or " "..self.floor).." POWER:"..player_power_to_string(self.player_power),1,249) + --tutorial textboxes + local textboxes = self.level_data[self.floor].textboxes + for i=1,#textboxes do + love.graphics.setColor(0,0,0,1) + love.graphics.rectangle("fill",textboxes[i].x,textboxes[i].y,textboxes[i].w,textboxes[i].h) + love.graphics.setColor(1,1,1,1) + 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 + ) + end + --held item if self.player_item then love.graphics.draw(held_spr[self.player_item],72,250) diff --git a/leveldata.lua b/leveldata.lua index dac8f8c..656beca 100644 --- a/leveldata.lua +++ b/leveldata.lua @@ -42,7 +42,13 @@ function LevelData.new() {type = "stairs_up", x = 8, y = 2}, {type = "gate", x = 8, y = 3}, }, - textboxes = {} + 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.", + } + } }, { --floor 2 walls = {