Load background image and draw it

main
Tyler Scott 2022-02-02 20:56:13 +07:00
parent 9fc543a95a
commit f8bff917f1
2 changed files with 14 additions and 0 deletions

BIN
images/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,3 +1,17 @@
local game = {}
function love.load(arg)
game.images = {}
game.images.background = love.graphics.newImage('images/background.png')
game.images.background_width = game.images.background:getWidth()
end
function love.draw()
love.graphics.draw(game.images.background, 0, 0)
love.graphics.draw(game.images.background, game.images.background_width, 0)
end
function love.keypressed(key, scan_code, is_repeat) function love.keypressed(key, scan_code, is_repeat)
if key == 'escape' then if key == 'escape' then
love.event.quit() love.event.quit()