How to make an actor jumping on a fixed y-position?
Hey everybody,
when I have an actor that can jump and I have a second actor which is a wall and
I want the jumping actor only be able to jump when standing on the plattform?
Because when I say it with collide, I can also jump on the edge even if I am not
standing on it anymore.
So how do I set up this?
when I have an actor that can jump and I have a second actor which is a wall and
I want the jumping actor only be able to jump when standing on the plattform?
Because when I say it with collide, I can also jump on the edge even if I am not
standing on it anymore.
So how do I set up this?
Comments
Here. The "cbt" actor on the scene is unlocked and changed. The logic is, if "cbt" is on top of blue and within 5 pixels above it, jump.
here is the best I've come up with so far, make another actor called "feet" or something, and constrain it to your hero actor. do something like this
this would go in the "feet" actor:
constrain self position X to hero's X
constrain self position Y to hero's Y -half the actors height
make a new global rule called "touching ground" or "grounded" etc.
then back in the feet actor add another rule that says:
if feet collide with ground change grounded to true
and then in otherwise: change grounded to false
then finally, add the second condition to your players your jump rule
if jump button is pressed and if grounded is true
now the problem you run into here is the second your hero is off the ground, grounded becomes false. two ways to go around this are, add a timer (uncheck run to completion) to the otherwise in the feet collide with ground rule.
or what I like better, in your jump rule add two timers that have run to completion checked
and say for 1 second (or how every long you want the jump to be) constrain >self motion> linear velocity Y> to 80, 100, or however fast you want your player to move up. and after 1 second change> self motion> linear velocity Y> to 0
then after 1 second whatever gravity you have applied to your hero will kick back in and pull him back down
this is all based on the idea your hero is going to have a fixed rotation, if your player can rotate then you'll need more attributes and more complicated constraints on the feet to keep them where his feet would be at all times
hope some of this helps!
I've never used jumping in any of my projects. So my jump is so bad, I'd prefer waiting half a million year for erosion to eat up everything so I don't have to jump.
But If there is only 1 platform he wants to jump on, my detection system is much more easier and system friendly. But I'm sure he'll use your jump..
thank you but I have some problems to understand your suggestion.
In your case I have three actors:
hero
feet
ground
But if I say in the feet actor, when collide with ground, change grounded to true, it will again be possible to jump even if not standing on the ground (plattform) because the actor also collides when touching it at the edge!
thx
thank you!!
Somehow it seems that the grounded attribute is not set true?!
I changed the size of feet and the ground actor to heigth 1!
In the actor I said:
when collide with ground change attribute to true otherwise set it to false..
Where is the failure?
thx
I tried I think all that I know to solve this problem
thx
Thx
thx