Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- player = { x = 200, y = 710, speed = 1510, img = nil}
- --timers
- canShoot = true
- canShootTimerMax = 0.2
- canShootTimer = canShootTimerMax
- -- store the image file
- bulletImg = nil
- --store bullet entity
- bullets = {} -- array of bullets being drawn and updated
- function love.load(arg)
- player.img = love.graphics.newImage('assets/plane.png')
- player.img = love.graphics.newImage('assets/bullet.png')
- end
- function love.update(dt)
- --start with way to close
- if love.keyboard.isDown('escape') then
- love.event.push('quit')
- end
- if love.keyboard.isDown('left', 'a') then
- if player.x > 0 then --binds us to
- player.x = player.x - (player.speed*dt)
- end
- elseif love.keyboard.isDown('right','d') then
- if player.x < (love.graphics.getWidth() - player.img:getWidth()) then
- player.x = player.x + (player.speed*dt)
- end
- end
- end
- function love.draw(dt)
- love.graphics.draw(player.img, player.x, player.y)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement