lua-love-platformer/player.lua
Tyrel Souza ae5da288ca jump around
jump around
2018-01-17 23:17:31 -05:00

21 lines
503 B
Lua

player = {}
-- Physics Engine
player.body = love.physics.newBody(myWorld, 100, 100, 'dynamic')
player.shape = love.physics.newRectangleShape(66, 92)
player.fixture = love.physics.newFixture(player.body, player.shape)
--
player.speed = 200
player.grounded = false
function playerUpdate(dt)
if love.keyboard.isDown('a') then
player.body:setX(player.body:getX() - player.speed * dt)
end
if love.keyboard.isDown('d') then
player.body:setX(player.body:getX() + player.speed * dt)
end
end