Platform Movement with Touch Controls Question

Get help using Construct 2

Post » Wed Jun 19, 2013 9:21 pm

Hello All,

As part of my ongoing development on my upcoming game I am trying to work out some touch controls. The game is a platformer and has the following features that will require some type of UI touchscreen control scheme:

Basic Platform Movement (Left, Right, Jump)
Fall Through (Press Down to fall through jumpthrough platforms)
Run
Double Jump
Wall Jump
Change Form (There are three different modes/forms the character learns during the game)
Action/Attack

Most of this is for the most part easy to do, the issue I am running into here is really on implementing the run option. When using the keyboard I simply assign a button down event to double the maxSpeed of the character and change the animation to the Run animation. However, I am finding it harder to do with a touchscreen control setup. I do not want the player to have to hold down multiple buttons as that is very difficult on a touchscreen game. My thoughts are to do one of the following:

1. Implement a double tap on the left/right movement buttons that starts the run. (I am trying to find a good way to do this using a state variable and a timer).

2. Implement a toggle button on the screen that if it is pressed while moving it will double the walk speed and change to the run animation. This one has been a bit difficult.

The difficulty in both of these seems to stem from having to use the on touch simulate platform left/right events to get the initial movement working. I believe this is overriding everything else. What I tried at this point is having a global variable called "running". Normally this is set to 0. If they touch the run button while they are walking (Holding the left/right touchscreen buttons) it should set the walk speed and animation accordingly however this does not ever seem to work.

My assumption is that since the touch left/right button events are written as "Is Touching button > Simulate Platform Pressing Right" that it is overriding anything else I try to do to the movement. Below are some of the various schemes I have tried while working on this, none of them seem to do what I want.

The base movement updated with touch events and keying off the running variable:



The touch events


And Another option trying to detect when they let go of the left/right buttons to deactivate the run:




ALso here the updated double jump logic to take touch into account as well, this works just fine it is just to illustrate how I am integrating keyboard and touch into the same project:



The jumping, double jumping and even the wall jumping all work as expected with touch, but the run does not work at all. Once in awhile I will see the character start the first frame of the run animation when the run button is touched while walking, but that is as far as it goes. It reverts right back to regular speed and walk animation. The various variables used in the events are pretty self explanatory based on their names, but if anyone needs clarification just let me know.

Thanks,

James
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,548

Post » Wed Jun 19, 2013 9:23 pm

I would prefer a double tap option on the walk buttons to toggle running, but that has not been as easy as I thought. I used some examples from the forums but they are more generic and allow touch anywhere on the screen instead of double tapping on a specific control. If anyone has implemented walking/running on platform with touch events please let me know, I would also love a slide/dash option as well but that is not required for this game, just nice to have.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,548

Post » Wed Jun 19, 2013 9:31 pm

would splitting the move "zone" into two sections not work?...

Imagine a virtual D pad in this case the player is going right
with the player sliding the thumb more to the right of the D pad to invoke run and back to the left slightly to revert back to walk?...double tapping never feels reliable enough to me...

Stuff like this really shows the deficiency of touch input for gaming...Pixel perfick2013-06-19 21:34:53
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Wed Jun 19, 2013 9:36 pm

I would say do something similar to

On Touch Release RightButton
-- set runright 1
-- wait 1
-- set runright = 0
--if player.isRunning = 1
--- player.isRunning = 0

OnTouch Pressed RightButton
--if runright = 0
---- set player speed to normal, walk animation, player.moveright = 1
--if runright = 1
---- set player speed to run, do run animation, player.moveright = 2

Is InTouch rightbutton
-- if player.moveright = 1
---- continue walking
-- id player.moveright = 2
---- continue running


also you could just make an analog based control. make it wide so that the player has good degree of difference between walking and running.

Then
if analogstick.X > 0 and < 80% then do walk stuff
if analogstick.X > 80 then do run stuff
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Wed Jun 19, 2013 9:47 pm

@jayderyu I can't find a touch release or touch end event that lets you specify which object is being released. The end touch events seem to be any touch, or nth touch. Not specific to an object which is what I really need in this case. Then I could do something like on touch end, start timer, and if touched again before the timer runs out trigger the run.

I will try to implement as close to what you have suggested as I can and see how far that gets me.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,548

Post » Thu Jun 20, 2013 12:29 am

How about something like this for the touch end?

TouchRelease.capx (r134)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Jun 20, 2013 5:36 am

@Nimtrix once I can get C2 to stop crashing everytime I alt+tab in the latest build I will test it. Thanks!
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,548


Return to How do I....?

Who is online

Users browsing this forum: pokka and 5 guests