love2d-tutorial-runner/steps/4_spaceship1/main.lua

32 lines
740 B
Lua
Raw Permalink Normal View History

2018-05-15 16:07:59 +02:00
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
2018-05-20 18:43:25 +02:00
-- Spaceship
2018-05-15 16:07:59 +02:00
spaceship = {}
spaceship.img = love.graphics.newImage('assets/sprites/spaceship.png')
2018-05-20 18:43:25 +02:00
spaceship.x = 200
spaceship.y = 200
2018-05-15 16:07:59 +02:00
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