Skip to content

Instantly share code, notes, and snippets.

@ianfitzpatrick
Created August 18, 2016 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianfitzpatrick/2050a6187c44fe07a1185d0cbd7552af to your computer and use it in GitHub Desktop.
Save ianfitzpatrick/2050a6187c44fe07a1185d0cbd7552af to your computer and use it in GitHub Desktop.
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