How to make actor jump when touching the screen

Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

Hello everyone, Thor speaking here. I am a bit stuck on this, i have seen a couple tutorials but most of them are with arrow keys not with touching the screen.
So i wanted to know how to make an actor jump up when touching the screen.
Also when it is in mid-air, how would i make it do another jump, but i only want it to be able to do 2 jumps in total, then it will fall back down..

Thanks.

Thor.

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Let me make you a quick demo.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Here you go. Simple once you know how to do it. Hope it helps.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited April 2015

    There are a few ways you could detect a touch to the screen.

    1. Access the Attribute game.Touch.Count from the Attribute Browser, Devices » Touches » Count.
    2. When that equals 1 trigger your jump routine

    You could also place a large invisible 'button' graphic over the entire screen and use a 'when touch is pressed' rule applied to the button actor to trigger the jump routine.

    Below is a link to a tutorial that covers setting up a double jump action, along with other movement options. The tutorial uses keyboard input, so you'd need to adapt it to whichever method you choose to trigger the actual jump.

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168
    edited April 2015

    @Braydon_SFX said:
    Here you go. Simple once you know how to do it. Hope it helps.

    Thankyou Braydon, your a star.

    But, do you know what i would need to change, so it jumps when it touches the screen not the actor itself?
    Sorry for the inconvenience.

    Thankyou.

    Thor.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    It does exactly that. When a touch is detected anywhere (mouse is down), it jumps. You do not need to tap the actor to make him jump.

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168
    edited April 2015

    @Braydon_SFX said:
    It does exactly that. When a touch is detected anywhere (mouse is down), it jumps. You do not need to tap the actor to make him jump.

    Oh sorry, i don't why it wasn't working at first, now its working :smiley:

    Haha, so sorry about that.

    Thankyou for that.

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

    And thank you jamie, for that advice.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    You're welcome, glad you got something working :)

Sign In or Register to comment.