oma-lander/game/world.lua
28allday 74c15e555a OMA-LANDER: fix flash, terrain overshoot, thrust particles, cleanups
- main.lua: flash logic was always true; now flashes only on crash,
  always on when landed. Remove empty fuel-depleted branch. Rotate
  thrust-particle spawn point by lander angle.
- particles.lua: jet velocity had wrong vy sign, shooting particles
  upward; now emits along local (0,1) rotated by the lander angle.
- terrain.lua: jagged step could overshoot the pad approach zone and
  produce an out-of-order point (zig-zag line, bad getHeightAt). Clamp
  the step to the approach boundary. Move Camera/World requires to
  module top instead of re-requiring inside the draw loop.
- camera.lua: drop unused midY local.
- fonts.lua/world.lua/main.lua: drop unused scale parameter on
  Fonts.init.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 22:10:58 +01:00

40 lines
865 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,
}
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