Last active
April 4, 2016 20:51
-
-
Save luizcarlos1405/36e8be0132cbf08bbb42c43f49b0e501 to your computer and use it in GitHub Desktop.
LÖVE 02 - Videoaula em: https://youtu.be/G4BkolU7vUM
This file contains hidden or 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 = 0 | |
Player.y = 0 | |
Player.r = 20 | |
Player.speed = 300 | |
Auto = {} | |
Auto.x = 0 | |
Auto.y = 0 | |
Auto.r = 5 | |
Auto.speed = 50 | |
end | |
function love.update(dt) | |
if love.keyboard.isDown("w") then | |
Player.y = Player.y - Player.speed * dt | |
end | |
if love.keyboard.isDown("a") then | |
Player.x = Player.x - Player.speed * dt | |
end | |
if love.keyboard.isDown("s") then | |
Player.y = Player.y + Player.speed * dt | |
end | |
if love.keyboard.isDown("d") then | |
Player.x = Player.x + Player.speed * dt | |
end | |
Auto.x = Auto.x + Auto.speed * dt | |
Auto.y = Auto.y + Auto.speed * dt | |
end | |
function love.draw() | |
love.graphics.circle("line", Player.x, Player.y, Player.r) | |
love.graphics.circle("fill", Auto.x, Auto.y, Auto.r) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment