better movement

main
Simon Kellet 4 months ago
parent df4184eec4
commit 8440be2ab1
  1. 9
      player.lua

@ -60,12 +60,15 @@ function Player:handleKeys(up, down, left, right, dt)
if love.keyboard.isDown(up) then
self.vx = cos(self.rotation) * (self.speed * dt)
self.vy = sin(self.rotation) * (self.speed * dt)
elseif love.keyboard.isDown(down) then
end
if love.keyboard.isDown(down) then
self.vx = cos(self.rotation) * (self.speed / 2 * dt) * -1
self.vy = sin(self.rotation) * (self.speed / 2 * dt) * -1
elseif love.keyboard.isDown(left) then
end
if love.keyboard.isDown(left) then
self.rotation = self.rotation - (self.rotSpeed * dt)
elseif love.keyboard.isDown(right) then
end
if love.keyboard.isDown(right) then
self.rotation = self.rotation + (self.rotSpeed * dt)
end
self.collider:setLinearVelocity(self.vx, self.vy)

Loading…
Cancel
Save