From 52f49377a69360ae5dbe63d067f9010f9be99787 Mon Sep 17 00:00:00 2001 From: Tangent Date: Thu, 27 Nov 2025 02:01:33 -0700 Subject: [PATCH] stage 1 --- src/main.lua | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main.lua diff --git a/src/main.lua b/src/main.lua new file mode 100644 index 0000000..cffdd2f --- /dev/null +++ b/src/main.lua @@ -0,0 +1,40 @@ +local screen_width, screen_height = love.graphics.getDimensions() + +local player_ship = { + position_x = screen_width / 2, + position_y = screen_height / 2, + velocity_x = 0, + velocity_y = 0, + acceleration = 100, + radar_size = 10, +} + +function love.update(dt) + if love.keyboard.isDown("w") then + player_ship.velocity_y = player_ship.velocity_y - player_ship.acceleration * dt + end + if love.keyboard.isDown("a") then + player_ship.velocity_x = player_ship.velocity_x - player_ship.acceleration * dt + end + if love.keyboard.isDown("s") then + player_ship.velocity_y = player_ship.velocity_y + player_ship.acceleration * dt + end + if love.keyboard.isDown("d") then + player_ship.velocity_x = player_ship.velocity_x + player_ship.acceleration * dt + end + + player_ship.position_x = player_ship.position_x + player_ship.velocity_x * dt + player_ship.position_y = player_ship.position_y + player_ship.velocity_y * dt +end + +function love.draw() + love.graphics.setColor(1, 1, 1, 1) + -- love.graphics.circle("fill", player_ship.position_x, player_ship.position_y, 5) + love.graphics.rectangle("line", player_ship.position_x - player_ship.radar_size / 2, player_ship.position_y - player_ship.radar_size / 2, player_ship.radar_size, player_ship.radar_size) +end + +function love.keypressed(key) + if key == "escape" then + love.event.quit() + end +end