Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function player:revertCollision(overlapX, overlapY)
- if overlapX ~= 0 then
- if self.velocityX > 0 then
- self.x = self.x - overlapX
- elseif self.velocityX < 0 then
- self.x = self.x + overlapX
- end
- self.velocityX = 0
- end
- if overlapY ~= 0 then
- if self.velocityY > 0 then
- self.y = self.y - overlapY
- elseif self.velocityY < 0 then
- self.y = self.y + overlapY
- end
- self.velocityY = 0
- end
- self.boundingRectangle.x = self.x
- self.boundingRectangle.y = self.y
- end
Advertisement
Add Comment
Please, Sign In to add comment