add spaceshipt
This commit is contained in:
parent
3c0dd6f667
commit
5aff3bf0a7
BIN
steps/4_spaceship/assets/Player_Ship2c.png
Normal file
BIN
steps/4_spaceship/assets/Player_Ship2c.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
BIN
steps/4_spaceship/assets/sprites/background.jpg
Normal file
BIN
steps/4_spaceship/assets/sprites/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
31
steps/4_spaceship/main.lua
Normal file
31
steps/4_spaceship/main.lua
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
function love.load()
|
||||||
|
game = {}
|
||||||
|
game.width = 800
|
||||||
|
game.height = 480
|
||||||
|
love.window.setMode(game.width, game.height)
|
||||||
|
score = { x = 500, y = 40 }
|
||||||
|
-- Background
|
||||||
|
background = {}
|
||||||
|
background.img = love.graphics.newImage('assets/sprites/background.jpg')
|
||||||
|
background.x = 0
|
||||||
|
background.y = 0
|
||||||
|
-- Spaceship
|
||||||
|
spaceship = {}
|
||||||
|
spaceship.img = love.graphics.newImage('assets/sprites/spaceship.png')
|
||||||
|
spaceship.x = game.height / 8
|
||||||
|
spaceship.y = (game.height / 4) - (spaceship.img:getHeight() / 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
function love.draw()
|
||||||
|
-- Background
|
||||||
|
love.graphics.draw(background.img, background.x, background.y)
|
||||||
|
-- Spaceship
|
||||||
|
love.graphics.draw(spaceship.img, spaceship.x, spaceship.y)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Controls
|
||||||
|
function love.keypressed(key, scancode, isrepeat)
|
||||||
|
if key == 'escape' then
|
||||||
|
love.event.push('quit')
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user