This commit is contained in:
2025-12-03 23:22:31 +01:00
parent d985320f44
commit 6f65332ad8

View File

@@ -1,8 +1,8 @@
-- title: game title -- title: Mr Anderson's Addventure
-- author: game developer, email, etc. -- author: Zsolt Tasnadi
-- desc: short description -- desc: Life of a programmer in the Matrix
-- site: website link -- site: http://teletype.hu
-- license: MIT License (change this to your license of choice) -- license: MIT License
-- version: 0.1 -- version: 0.1
-- script: lua -- script: lua
@@ -15,9 +15,14 @@ gameState = STATE_MENU
menuItems = {"Play", "Exit"} menuItems = {"Play", "Exit"}
selectedMenuItem = 1 selectedMenuItem = 1
function draw_top_bar(title)
rect(0, 0, 240, 10, 0)
print(title, 3, 2, 13)
end
function draw_menu() function draw_menu()
cls(13) cls(13)
print("Main Menu", 90, 40, 15) draw_top_bar("Main Menu")
for i, item in ipairs(menuItems) do for i, item in ipairs(menuItems) do
local color = 14 local color = 14
if i == selectedMenuItem then if i == selectedMenuItem then
@@ -59,12 +64,14 @@ end
-- Screen data -- Screen data
screens = { screens = {
{ -- Screen 1 { -- Screen 1
name = "Home Screen",
platforms = { platforms = {
{x = 80, y = 110, w = 40, h = 8}, {x = 80, y = 110, w = 40, h = 8},
{x = 160, y = 90, w = 40, h = 8} {x = 160, y = 90, w = 40, h = 8}
} }
}, },
{ -- Screen 2 { -- Screen 2
name = "Second Screen",
platforms = { platforms = {
{x = 30, y = 100, w = 50, h = 8}, {x = 30, y = 100, w = 50, h = 8},
{x = 100, y = 80, w = 50, h = 8}, {x = 100, y = 80, w = 50, h = 8},
@@ -72,6 +79,7 @@ screens = {
} }
}, },
{ -- Screen 3 { -- Screen 3
name = "Third Screen",
platforms = { platforms = {
{x = 50, y = 110, w = 30, h = 8}, {x = 50, y = 110, w = 30, h = 8},
{x = 100, y = 90, w = 30, h = 8}, {x = 100, y = 90, w = 30, h = 8},
@@ -167,6 +175,8 @@ function game_update()
-- Clear screen -- Clear screen
cls(13) cls(13)
draw_top_bar(screens[currentScreen].name)
-- Draw platforms -- Draw platforms
for i, p in ipairs(currentPlatforms) do for i, p in ipairs(currentPlatforms) do
rect(p.x, p.y, p.w, p.h, 14) rect(p.x, p.y, p.w, p.h, 14)