-
-
Save videlais/ba3f7805adeeaa7d7e3d4f5df90d647b to your computer and use it in GitHub Desktop.
main.lua second example
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
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