Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function love.load()
- Object = require "classic" -- classic is the library used to simulate classes
- require "player"
- require "enemy"
- require "bullet"
- player = Player()
- enemy = Enemy()
- -- we need to shoot bullets, so a list of bullets is created
- listOfBullets = {}
- end
- function love.keypressed(key)
- player:keyPressed(key)
- end
- function love.update(dt)
- player:update(dt)
- enemy:update(dt)
- -- iterate through the table and update/draw all the bullets
- for i,v in ipairs(listOfBullets) do
- v:update(dt)
- end
- end
- function love.draw()
- player:draw()
- enemy:draw()
- for i,v in ipairs(listOfBullets) do
- v:draw()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment