oma-lander/game/world.lua
2026-04-18 23:20:40 +01:00

43 lines
934 B
Lua

local World = {
WORLD_W = 4000,
WORLD_H = 2000,
screenW = 0,
screenH = 0,
baseScale = 1,
state = "title",
score = 0,
highScore = 0,
fuel = 750,
time = 0,
stateTimer = 0,
landingResult = "",
landingPoints = 0,
gravity = 12,
startFuel = 750,
difficultyName = "PILOT",
}
function World.resize(w, h)
if not w or not h then w, h = love.graphics.getDimensions() end
World.screenW = w
World.screenH = h
World.baseScale = w / World.WORLD_W
end
function World.ensureScale()
local w, h = love.graphics.getDimensions()
if w ~= World.screenW or h ~= World.screenH then
World.resize(w, h)
local Fonts = require("rendering.fonts")
Fonts.init()
end
end
function World.addScore(points)
World.score = World.score + points
if World.score > World.highScore then
World.highScore = World.score
end
end
return World