Here is an example
Code: Select all
function Player:update(dt)
self.xVel, self.yVel = self.collider:getLinearVelocity()
currentAnim:update(dt)
if self.collider:enter('Border') or self.collider:enter('Ballz') then
self.grounded = true
elseif self.collider:exit('Border') or self.collider:exit('Ballz') then
self.grounded = false
end
self:move(dt)
self:skyAnim()
end
After the player hits the ball, it plays the sky animations and it's unable to jump. I had an Idea of placing a collidable line on top of the ball and set it's type to "Ballz". However I came across a new issue. I don't want the line to collide with the ball but I also don't want the line to move from it's original position. I tried to implement Revolute Joints and Distance Joints but neither gave me the desired effect. Would gear joints be a better option?