How to change jump intensity according to tap intensity

davidsalomondavidsalomon Member Posts: 136
edited December 2012 in Working with GS (Mac)
Hello everyone, can someone help me out how can I change the jump intensity (self.Motion.Linear Velocity.Y) according to the intensity of the tapping of the user? Just like the ePig Dash.

Comments

  • TheFrogeekTheFrogeek Member Posts: 97
    I hope you'll understaind my bad English.

    When jump is True: change attribute
    self motion linear velocity Y to +y (y is the number of your choise).

    When jump is false: interpolate behaviour
    self motion linear velocity Y to -y (y is the number of your choise).

    Or when jump is false: accelerate behaviour
    orientation: 270, speed: y (y is the number of your choise).

    The problem with the interpolation is: when you will release jump button, if the interpolation time is too long, your character will continue to go higher for a little time.
    The probleme with accelerate behavior is: when you release jump button your character may go down too roughly.

    It depend of what you are looking for your gameplay: something smooth use interpolate behaviour.
    If you want something precise (maybe too precise) use accelerate behaviour.

    But maybe some one have an other way to do it.

    Have a nice day.
  • LooseMooseLooseMoose Member Posts: 224
    By jump intensity I assume you mean air-time?

    Try this:

    In your hero add an acceleration rule in downwards direction(270) at a speed on 1000.

    Create a jump button actor and make an interger attribute called jump.
    In your jump button make a rule:
    WHEN - mouse button is down
    DO -Change attribute jump to 1, else change attribute jump = 0

    In your hero make a rule:
    WHEN - jump = 1
    DO - Change velocity in upwards direction(90) at a speed of 600
    ELSE - Change velocity in downwards direction(270) at a speed of 200

    You might have to play around with those numbers to find what suits you best. Or maybe someone can give you a better solution. Good luck
  • davidsalomondavidsalomon Member Posts: 136
    @kloo13: Thank you for your reply, I'll re-read your post once again.

    @Kyukon: What I mean is that if the user taps the jump button "weak" then the hero will jump a little. But if the user taps the jump button "hard" then the hero will jump more, and if the user taps it "harder" then the hero will jump a lot.
    Should I play with timers? Any advices?
  • LooseMooseLooseMoose Member Posts: 224
    edited December 2012
    I don't believe apple devices have a function that detects the applied pressure from a touch.

    Also what @kloo13 said is just an alternative version of what I said.
  • davidsalomondavidsalomon Member Posts: 136
    I know that it's not according to pressure, I just wanted to let you know what I ment.

    I think I will have to experiment according to the milliseconds that the finger is in the jump button to simulate the strength that the hero uses to jump.
  • LooseMooseLooseMoose Member Posts: 224
    That's exactly what my example does. If you hold the touch down you can get about 3 maximum seconds air-time and if you tap in quick then release you get about minimum 0.5 second air-time.
  • davidsalomondavidsalomon Member Posts: 136
    I tried it out but it didn't work as that because I'm just making option A or B, jump or no jump, I'm not using timers.
    I'll see if I come out with something with timers.
    Depending if the press is between 0<x<0.5 or 0.5<x<1 .. Something like that.
  • LooseMooseLooseMoose Member Posts: 224
    Then just replace my interger jump attribute with which ever type of jump attribute you are using? I tested my method and it worked, but if you want to use timers that's up to you, but it might affect your game performance in the long run. Good luck
  • davidsalomondavidsalomon Member Posts: 136
    Then just replace my interger jump attribute with which ever type of jump attribute you are using? I tested my method and it worked, but if you want to use timers that's up to you, but it might affect your game performance in the long run. Good luck
    Maybe I'm doing something different. Is there a way you could send me that little piece of game? I sent you a PM :)
Sign In or Register to comment.