-
-
Save ianfitzpatrick/2050a6187c44fe07a1185d0cbd7552af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
io.stdout:setvbuf('no') | |
debug = true | |
function love.load(arg) | |
love.window.setMode( 1280, 720) | |
bg = { x = 0, y = 0 } | |
bg.img = love.graphics.newImage('assets/graphics/backgrounds/football_field_bg.png') | |
love.graphics.setBackgroundColor( 0, 0, 0 ) | |
scroll = { rate = 400 } | |
end | |
function love.update(dt) | |
-- require('lovebird').update() | |
-- Testing screen scrolling | |
if love.keyboard.isDown('right') then | |
if bg.x > -4480 then | |
bg.x = bg.x - dt*scroll.rate | |
end | |
end | |
if love.keyboard.isDown('left') then | |
if bg.x < 0 and canscroll then | |
bg.x = bg.x + dt*scroll.rate | |
end | |
end | |
end | |
function love.draw() | |
love.graphics.draw(bg.img, bg.x, bg.y) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment