Character losing momentum from conveyor belt when jumps, goes directly up instead.
I'm making a platformer game, it uses a conveyor belt that uses move behaviour so moving left or right doesn't break the conveyor, it moves the player in one direction only.
The character moves around using linear motion x and y
When I touch conveyor it moves the character in a direction at its walkspeed
When I press space to jump, which is self.linearmotion.y 120, the character loses all momentum from conveyor belt
and just jumps directly up
I'm wondering how to transfer the conveyor belt x momentum to the character
I tried velocity and accelaration but not only does the momentum not go to 0 once off the conveyor causing the character to slide but, pressing left or right keys (which is walk left and right) takes away the effect and breaks the conveyor, i'm looking to only remove the character from the conveyor via jump command and maintain the jump arc from it.
Any tips if i need constraints or something?
Thanks,
Comments
Create 2 boolean attributes, and for this conversation, lets call them "grounded" and "onconveyer" Then inside your character, create a new rule that says when the actor touches the conveyor, change the "onconveyer" attribute to true, and the "grounded" attribute to false. And a rule that says when the actor touches the regular ground, change the "onconveyer" attribute to false, and the "grounded" attribute to true.
Create another rule below that one that says when "All" conditions are true the actor jumps, and the attribute "onconveyor" is true, add a self.linearmotion.x to whatever the linear motion is of your walk speed to that jump rule.
Edit: This should replace your current jump rule. And in the "otherwise" section of this new jump rule, put your old jump rule in there.
Try using a change attribute behavior:
Change Attribute: self.motion.linear velocity.Y To: 120
Also make sure that you either have gravity in the y direction set to 100 (or so..)
If you do not want to use scene gravity. Then put an accelerate behavior in the actor to that it is accelerating downward (270) at a speed of about 100. (That will simulate gravity on the actor.)
Best way to describe this is that it's like Manic miner?