Skip to content

Instantly share code, notes, and snippets.

@ianfitzpatrick
Created August 18, 2016 02:29
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/262600365fe8e25ae3bc64247f1c5f14 to your computer and use it in GitHub Desktop.
Save ianfitzpatrick/262600365fe8e25ae3bc64247f1c5f14 to your computer and use it in GitHub Desktop.
@@ -6,7 +6,7 @@
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 = 10 }
+ scroll = { rate = 400 }
end
function love.update(dt)
@@ -16,13 +16,13 @@
if love.keyboard.isDown('right') then
if bg.x > -4480 then
- bg.x = bg.x - scroll.rate
+ 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 + scroll.rate
+ bg.x = bg.x + dt*scroll.rate
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment