Simulate/Change Keyboard buttons to Touch screen.

0 favourites
  • 8 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I've been having this issue for a while now and was hoping someone can help me out here. Basically i wanted to add a touch duration feature to my game where the longer keep hold of touching the screen, the longer/higher the jump.

    I've kind of worked out a way to do this, which is by doing the following:-

    Keyboard (On any key pressed) Player (Simulate Platform pressing Jump)

    Keyboard (On any key pressed) Player (Set Platform Gravity to 2200)

    Keyboard (On any key released) Player (Set Platform Gravity to 3500)

    I'm not sure if this is the ideal way of doing it but it sort of works the way i want it to. The issue is i can't implement the touch feature for this to work exactly how it works with the keyboard.

    The way it works now is fine as the jump is capped and if i keep a button on the keyboard pressed, it jumps higher. But if i change it from keyboard to any Touch condtition, it doesn't do the same thing as it just jumps normally without any change.

    This does seem like something really simple and obvious to do but I can't work out how to do this, so i hope someone can help.

    I've provided a simple capx file to show what i've done so far.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Use is touching -> add gravity+(howmuchyouwanttoadd)

    I think it will works, CMIIW

  • This method isn't working for me as it only does one type of jump no matter how long i keep it pressed. Any other suggestions? All i really need to convert the keyboard keys in my example into a touchscreen actions. It doesn't recognise that i'm keeping hold of touch the screen and then letting go.

  • Check conditions

    --Platformer Jumping?

    --Not In Touch?

    --Not in Keyboard Key Press

    Then reduce the Y vector of the platformer by a constant or divide it.

    No need to adjust gravity.

    This is the best trick I have found

  • That thread you originally linked was started by me, I posted it in the beginners forum. I did mention in that thread that the suggestions didn't work for me and that if there were any other suggestions or if someone could show an example with the capx file provided, then that would be helpful. I didn't get a response after that so I thought I'd start the thread in this forum rather than the beginners one.

    Like I mentioned, I've not been able to get this to work but would appreciate if you can show it working with the capx file I've included as an example.

  • rayray Here is your template that has been modified to check to see if the buttons causing the jump are still being pressed during a jump. If the buttons that can cause the jump are not being pressed in some way while the platform object is jumping, then you reduce the platformer's Y vector.

    As stated, it doesn't have to be Y/4, like in my example, it can be whatever number feels good to you (equation, constant, etc).

    [attachment=0:ua8ev4c0][/attachment:ua8ev4c0]

  • For those too lazy to download the .capx

  • Thank you. That's really helpful, I can see where I was going wrong.when I tried this out. Thanks again.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)