purge
This commit is contained in:
@@ -5,18 +5,6 @@ ConfigurationWindow = {
|
||||
|
||||
function ConfigurationWindow.init()
|
||||
ConfigurationWindow.controls = {
|
||||
UI.create_numeric_stepper(
|
||||
"Move Speed",
|
||||
function() return Config.physics.move_speed end,
|
||||
function(v) Config.physics.move_speed = v end,
|
||||
0.5, 3, 0.1, "%.1f"
|
||||
),
|
||||
UI.create_numeric_stepper(
|
||||
"Max Jumps",
|
||||
function() return Config.physics.max_jumps end,
|
||||
function(v) Config.physics.max_jumps = v end,
|
||||
1, 5, 1, "%d"
|
||||
),
|
||||
UI.create_action_item(
|
||||
"Save",
|
||||
function() Config.save() end
|
||||
|
||||
@@ -2,27 +2,6 @@ function GameWindow.draw()
|
||||
local currentScreenData = Context.screens[Context.current_screen]
|
||||
|
||||
UI.draw_top_bar(currentScreenData.name)
|
||||
|
||||
-- Draw platforms
|
||||
for _, p in ipairs(currentScreenData.platforms) do
|
||||
rect(p.x, p.y, p.w, p.h, Config.colors.green)
|
||||
end
|
||||
|
||||
-- Draw items
|
||||
for _, item in ipairs(currentScreenData.items) do
|
||||
spr(item.sprite_id, item.x, item.y, 0)
|
||||
end
|
||||
|
||||
-- Draw NPCs
|
||||
for _, npc in ipairs(currentScreenData.npcs) do
|
||||
spr(npc.sprite_id, npc.x, npc.y, 0)
|
||||
end
|
||||
|
||||
-- Draw ground
|
||||
rect(Context.ground.x, Context.ground.y, Context.ground.w, Context.ground.h, Config.colors.dark_grey)
|
||||
|
||||
-- Draw player
|
||||
Player.draw()
|
||||
end
|
||||
|
||||
function GameWindow.update()
|
||||
@@ -31,7 +10,21 @@ function GameWindow.update()
|
||||
MenuWindow.refresh_menu_items()
|
||||
return
|
||||
end
|
||||
Player.update() -- Call the encapsulated player update logic
|
||||
if Input.select() then
|
||||
if Context.current_screen == #Context.screens then
|
||||
Context.current_screen = 1
|
||||
else
|
||||
Context.current_screen = Context.current_screen + 1
|
||||
end
|
||||
end
|
||||
|
||||
if Input.player_interact() then
|
||||
PopupWindow.show_menu_dialog(npc, {
|
||||
{label = "Talk to", action = NPC.talk_to},
|
||||
{label = "Fight", action = NPC.fight},
|
||||
{label = "Go back", action = NPC.go_back}
|
||||
}, WINDOW_POPUP)
|
||||
end
|
||||
end
|
||||
|
||||
function GameWindow.set_state(new_state)
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
function InventoryWindow.draw()
|
||||
UI.draw_top_bar("Inventory")
|
||||
|
||||
if #Context.inventory == 0 then
|
||||
Print.text("Inventory is empty.", 70, 70, Config.colors.light_grey)
|
||||
else
|
||||
for i, item in ipairs(Context.inventory) do
|
||||
local color = Config.colors.light_grey
|
||||
if i == Context.selected_inventory_item then
|
||||
color = Config.colors.green
|
||||
Print.text(">", 60, 20 + i * 10, color)
|
||||
end
|
||||
Print.text(item.name, 70, 20 + i * 10, color)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function InventoryWindow.update()
|
||||
Context.selected_inventory_item = UI.update_menu(Context.inventory, Context.selected_inventory_item)
|
||||
|
||||
if Input.menu_confirm() and #Context.inventory > 0 then
|
||||
local selected_item = Context.inventory[Context.selected_inventory_item]
|
||||
PopupWindow.show_menu_dialog(selected_item, {
|
||||
{label = "Use", action = Item.use},
|
||||
{label = "Drop", action = Item.drop},
|
||||
{label = "Look at", action = Item.look_at},
|
||||
{label = "Go back", action = Item.go_back_from_inventory_action}
|
||||
}, WINDOW_INVENTORY_ACTION)
|
||||
end
|
||||
|
||||
if Input.menu_back() then
|
||||
GameWindow.set_state(WINDOW_GAME)
|
||||
end
|
||||
end
|
||||
@@ -41,7 +41,7 @@ function PopupWindow.update()
|
||||
if Input.menu_confirm() or Input.menu_back() then
|
||||
Context.dialog.showing_description = false
|
||||
Context.dialog.text = "" -- Clear the description text
|
||||
-- No need to change active_window, as it remains in WINDOW_POPUP or WINDOW_INVENTORY_ACTION
|
||||
-- No need to change active_window, as it remains in WINDOW_POPUP
|
||||
end
|
||||
else
|
||||
Context.dialog.selected_menu_item = UI.update_menu(Context.dialog.menu_items, Context.dialog.selected_menu_item)
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
function SplashWindow.draw()
|
||||
for y, row in ipairs(MapBedroom) do
|
||||
for x = 1, #row, 2 do
|
||||
local tile_id_hex = string.sub(row, x, x + 1)
|
||||
local tile_id = tonumber(tile_id_hex, 16)
|
||||
local screen_x = (x - 1) / 2 * 8
|
||||
local screen_y = (y - 1) * 8
|
||||
spr(tile_id, screen_x, screen_y, -1, 1, 0, 0, 1, 1)
|
||||
end
|
||||
end
|
||||
local txt = "Definitely not an Impostor"
|
||||
local w = #txt * 6
|
||||
local x = (240 - w) / 2
|
||||
local y = (136 - 6) / 2
|
||||
print(txt, x, y, 12)
|
||||
end
|
||||
|
||||
function SplashWindow.update()
|
||||
|
||||
Reference in New Issue
Block a user