How to make an actor jumping on a fixed y-position?

GuaveMediaGuaveMedia Member, PRO Posts: 1,262
edited November -1 in Working with GS (Mac)
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?

Comments

  • cbtcbt Member Posts: 644
    http://gamesalad.com/g/54096

    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.
  • cbtcbt Member Posts: 644
    You're welcome. You can ask if there is any part you don't understand..
  • ashtmjashtmj Member, PRO Posts: 405
    getting a good jump is really hard.
    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! :)
  • cbtcbt Member Posts: 644
    @ashtmj

    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.
    :D

    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..
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    @ashtmj

    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
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Okay it doesn't work, I am not able to jump on the plattform :/
    Somehow it seems that the grounded attribute is not set true?!

    I changed the size of feet and the ground actor to heigth 1!
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Okey, I figured out that the groundet boolean does NOT get set to true!

    In the actor I said:

    when collide with ground change attribute to true otherwise set it to false..

    Where is the failure?

    thx
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Arghhhrg... it drives me crazy ^^

    I tried I think all that I know to solve this problem :/ can somebody please just take a few minutes to help me?

    thx
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Can someone please help me out of my problem?

    thx
Sign In or Register to comment.