oma-roids/game/hud.lua
28allday bc88613e07 Asteroids: complete Love2D game with Omarchy integration
Faithful recreation of Atari Asteroids (1979) with vector wireframe aesthetic.
Auto-detects Omarchy system theme and font on launch.

Features:
- Inertia physics (zero friction), rotate/thrust/fire/hyperspace controls
- 3 asteroid sizes that split on destroy (large→medium→small)
- Large and small UFO saucers with AI (random vs aimed shooting)
- Screen wrapping for ship/asteroids/saucers, bullets expire at edges
- Ship death fragments, explosion particles
- Iconic heartbeat that speeds up as wave clears
- Wave progression (4→11 asteroids, speed ramps)
- 3 lives, extra life every 10k points
- Persistent high scores with 3-letter initial entry
- Procedural sound effects (beat, thrust, fire, explosions, saucer drone)
- Full-screen scaling, system font detection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 12:58:03 +01:00

45 lines
1.3 KiB
Lua

local World = require("game.world")
local Palette = require("rendering.palette")
local Fonts = require("rendering.fonts")
local Ship = require("game.ship")
local HUD = {}
function HUD.draw()
local p = Palette.get()
-- Pop out of game transform for crisp screen-space text
love.graphics.pop()
local font = Fonts.medium or love.graphics.getFont()
love.graphics.setFont(font)
local pad = 8
-- Score (top left)
love.graphics.setColor(p.hud)
love.graphics.print(string.format("%06d", World.score), pad, pad)
-- High score (top centre)
if World.highScore > 0 then
love.graphics.setFont(Fonts.small)
love.graphics.setColor(p.dim)
local hsText = string.format("%06d", World.highScore)
local tw = Fonts.small:getWidth(hsText)
love.graphics.print(hsText, (World.screenW - tw) / 2, pad)
end
-- Lives (small ship icons below score)
local iconY = pad + font:getHeight() + 6
local iconScale = 0.5
local iconSpacing = 20
for i = 1, math.min(World.lives, 10) do
Ship.drawIcon(pad + 10 + (i-1) * iconSpacing, iconY + 8, iconScale)
end
-- Restore game transform
love.graphics.push()
love.graphics.translate(World.offsetX, World.offsetY)
love.graphics.scale(World.scale)
end
return HUD