diff --git a/assets/asteroid/Asteroid 01 - Base.png b/assets/asteroid/Asteroid 01 - Base.png new file mode 100644 index 0000000..044cfd9 Binary files /dev/null and b/assets/asteroid/Asteroid 01 - Base.png differ diff --git a/assets/asteroid/Asteroid 01 - Explode.png b/assets/asteroid/Asteroid 01 - Explode.png new file mode 100644 index 0000000..c741ea1 Binary files /dev/null and b/assets/asteroid/Asteroid 01 - Explode.png differ diff --git a/assets/player/autocannon.png b/assets/player/autocannon.png new file mode 100644 index 0000000..f36b6cd Binary files /dev/null and b/assets/player/autocannon.png differ diff --git a/assets/ui/base_engine.png b/assets/ui/base_engine.png new file mode 100644 index 0000000..35f4d9f Binary files /dev/null and b/assets/ui/base_engine.png differ diff --git a/blaster.lua b/blaster.lua index 6c81bc1..c4b8d5e 100644 --- a/blaster.lua +++ b/blaster.lua @@ -3,7 +3,7 @@ Blaster = Object:extend() function Blaster:new(x, y, owner) self.x = x self.y = y - self.radius = 10 + self.radius = 5 self.height = self.radius * 2 self.width = self.radius * 2 self.speed = 700 diff --git a/entities/enemy.lua b/entities/enemy.lua index 646a536..67a144d 100644 --- a/entities/enemy.lua +++ b/entities/enemy.lua @@ -17,8 +17,8 @@ function Enemy:new(x, y, radius) self.type = "enemy" self.health = 10 self.move_radius = radius - self.speed = 100 - self.fireRate = 2 + self.speed = 80 + self.fireRate = 1 self.destroy = false self.bounds = { (self.x + 18), (self.x + 44), (self.y + 20), (self.y + 44) } diff --git a/entities/player.lua b/entities/player.lua index 966e022..c7efe12 100644 --- a/entities/player.lua +++ b/entities/player.lua @@ -58,17 +58,13 @@ function Player:update(dt, enemies) end function Player:draw() - --local vert = { self.x, self.y, (self.x - 70), (self.y + 70), (self.x + 70), (self.y + 70) } - --love.graphics.polygon("fill", vert) local fullHealth = self.image[1][2] love.graphics.draw(fullHealth, self.x, self.y) for _, v in ipairs(playerBullets) do - --love.graphics.setColor(v.color) v:draw() end - --love.graphics.setColor(1, 1, 1) end function Player:keyPressed(key) diff --git a/main.lua b/main.lua index 387d2d6..b003a9e 100644 --- a/main.lua +++ b/main.lua @@ -1,13 +1,14 @@ function love.load() Object = require("scripts.classic") - --require("blaster") require("entities.player") require("entities.enemy") + require("ui") + ui = Ui(600, 800) local window_width = love.graphics.getWidth() local window_height = love.graphics.getHeight() - - player = Player(window_width / 2, window_height * 0.8) + --place the player in the middle of the screen, close to the bottom + player = Player(window_width / 2, window_height * 0.9) listOfEnemies = {} @@ -31,6 +32,7 @@ function love.update(dt) end function love.draw() + ui:draw() player:draw() for _, v in ipairs(listOfEnemies) do v:draw() diff --git a/ui.lua b/ui.lua index 27c86b9..f61c922 100644 --- a/ui.lua +++ b/ui.lua @@ -1,3 +1,24 @@ +Ui = Object:extend() + +--Set game canvas size +function Ui:new(window_width, window_height) + self.playableSpace = { window_width, window_height, (window_width * 0.25) } + self.score = 0 + + love.window.setMode((window_width * 1.5), window_height) +end +--set window size + +function Ui:draw() + local left_line = self.playableSpace[3] + local right_line = self.playableSpace[1] + self.playableSpace[3] + local window_height = self.playableSpace[2] + love.graphics.line(left_line, 0, left_line, window_height) + love.graphics.line(right_line, 0, right_line, window_height) +end + +--set + --display the score --display player health