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.
42 lines
876 B
42 lines
876 B
function love.load()
|
|
Object = require("scripts.classic")
|
|
--require("blaster")
|
|
require("entities.player")
|
|
require("entities.enemy")
|
|
|
|
local window_width = love.graphics.getWidth()
|
|
local window_height = love.graphics.getHeight()
|
|
|
|
player = Player(window_width / 2, window_height * 0.8)
|
|
|
|
listOfEnemies = {}
|
|
|
|
table.insert(listOfEnemies, Enemy(100, 100, 70))
|
|
|
|
--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()
|
|
player:draw()
|
|
for _, v in ipairs(listOfEnemies) do
|
|
v:draw()
|
|
end
|
|
end
|
|
|
|
function love.keypressed(key)
|
|
player:keyPressed(key)
|
|
end
|
|
|