local PlayerActions = Object:extend() local BASE_SPEED = 120 local JMP_STRENGHT = 2.5 function PlayerActions:initActions() self.isJumping = false end function PlayerActions:actionMove() if self.keys["up"].isDown then self.ysp = -BASE_SPEED self.charDir = "up" end if self.keys["down"].isDown then self.ysp = BASE_SPEED self.charDir = "down" end if self.keys["left"].isDown then self.xsp = -BASE_SPEED self.charDir = "left" end if self.keys["right"].isDown then self.xsp = BASE_SPEED self.charDir = "right" end end function PlayerActions:actionJump() if self.keys["B"].isPressed then if (self.onGround) then self:goUpward(JMP_STRENGHT) self.isJumping = true self.assets.sfx["jump"]:play() end end end function PlayerActions:actionSwitch() if self.keys["select"].isPressed and self.onGround then self:switchActiveCharacter() end end function PlayerActions:endJump() self.isJumping = false end return PlayerActions