You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
Object = require("scripts.classic")
|
|
require("entities.player")
|
|
require("entities.enemy")
|
|
require("userInterface")
|
|
|
|
function love.load()
|
|
--adjust the screen and set the bounds of the UI
|
|
ui = User_Interface(600, 800)
|
|
local window_width = love.graphics.getWidth()
|
|
local window_height = love.graphics.getHeight()
|
|
local bounds = ui:returnBounds()
|
|
|
|
--place the player in the middle of the screen, close to the bottom
|
|
player = Player(window_width / 2, window_height * 0.9, bounds)
|
|
|
|
listOfEnemies = {}
|
|
|
|
table.insert(listOfEnemies, Enemy(bounds[1] + 20, 100, 70, bounds))
|
|
|
|
--set background for space!
|
|
love.graphics.setBackgroundColor(27 / 255, 51 / 255, 85 / 255)
|
|
end
|
|
|
|
function love.update(dt)
|
|
player:update(dt, listOfEnemies)
|
|
|
|
for i, v in ipairs(listOfEnemies) do
|
|
if v.destroy == true then
|
|
print("Enemy destroyed! Enemies in Table:", #listOfEnemies)
|
|
table.remove(listOfEnemies, i)
|
|
end
|
|
|
|
v:update(dt, player)
|
|
end
|
|
end
|
|
|
|
function love.draw()
|
|
ui:draw()
|
|
player:draw()
|
|
for _, v in ipairs(listOfEnemies) do
|
|
v:draw()
|
|
end
|
|
end
|
|
|
|
function love.keypressed(key)
|
|
player:keyPressed(key)
|
|
end
|
|
|