Simulate/Change Keyboard buttons to Touch screen.

Get help using Construct 2

Post » Wed Jun 04, 2014 4:29 pm

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.
You do not have the required permissions to view the files attached to this post.
Image ImageImage
B
7
S
2
G
1
Posts: 91
Reputation: 1,239

Post » Wed Jun 04, 2014 5:16 pm

Use is touching -> add gravity+(howmuchyouwanttoadd)

I think it will works, CMIIW
B
8
S
2
Posts: 203
Reputation: 1,169

Post » Thu Jun 05, 2014 3:47 pm

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.
Image ImageImage
B
7
S
2
G
1
Posts: 91
Reputation: 1,239

Post » Thu Jun 05, 2014 4:02 pm

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

viewtopic.php?f=147&t=75106&p=624913&hilit=mario+style+jump#p624913
B
21
S
5
G
1
Posts: 96
Reputation: 1,927

Post » Thu Jun 05, 2014 5:30 pm

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.
Image ImageImage
B
7
S
2
G
1
Posts: 91
Reputation: 1,239

Post » Thu Jun 05, 2014 10:36 pm

@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 @tl22 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).

Autorunner Template Jumping.capx
You do not have the required permissions to view the files attached to this post.
Last edited by MrGoatsnake on Thu Jun 05, 2014 10:44 pm, edited 1 time in total.
B
21
S
5
G
1
Posts: 96
Reputation: 1,927

Post » Thu Jun 05, 2014 10:41 pm

For those too lazy to download the .capx ;)

Image
B
21
S
5
G
1
Posts: 96
Reputation: 1,927

Post » Fri Jun 06, 2014 3:32 pm

Thank you. That's really helpful, I can see where I was going wrong.when I tried this out. Thanks again.
Image ImageImage
B
7
S
2
G
1
Posts: 91
Reputation: 1,239


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests