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