Skip to content

Instantly share code, notes, and snippets.

@videlais
Created April 9, 2018 02:03
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 videlais/ba3f7805adeeaa7d7e3d4f5df90d647b to your computer and use it in GitHub Desktop.
Save videlais/ba3f7805adeeaa7d7e3d4f5df90d647b to your computer and use it in GitHub Desktop.
main.lua second example
function love.load()
player = {}
player.x = 100
player.y = 100
player.width = 20
player.height = 20
end
function love.update()
if love.keyboard.isDown("up") then
player.y = player.y - 20
end
if love.keyboard.isDown("down") then
player.y = player.y + 20
end
if love.keyboard.isDown("left") then
player.x = player.x - 20
end
if love.keyboard.isDown("right") then
player.x = player.x + 20
end
end
function love.draw()
love.graphics.rectangle("fill", player.x, player.y, player.width, player.height )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment