How do I add touch control for my platformer game?

Get help using Construct 2

Post » Thu Jun 26, 2014 5:23 pm

Hello,
I am new to C2 and this is probably the easiest question.
I just followed the beginner's platformer tutorial. All good, except I want to add on screen control but no luck so far.
I just want to add on screen control to make my character goes left, right, jump etc.
Please look at my event below.
Did I miss something?

Thank you.
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 24
Reputation: 485

Post » Thu Jun 26, 2014 6:15 pm

Hi. With this basic action the player always runs left when you touch the sprite4 object. Dont forget to disable "Default controls" in the behavior properties (left).

If you want the cross to work for 4 directions I would split it into 4 seperate parts or put an invisible "hotspot" object (I think it works if you put an TiledBackground with DefaultVisibility to Invisible) above each direction and then add an action for each of the hotspot objectc. So you can have one "Simulate pressing X" for each direction.

/update: Just tried it and it works with invisible objects.
Image
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
56
S
17
G
6
Posts: 748
Reputation: 9,420

Post » Fri Jun 27, 2014 5:47 am

Hi,
Thanks for your quick reply.
I tried but still don't work.
I disabled "Default controls" for my "Player". No effect on touch control.
Something still missing?
Thanks so much for spending time on me.
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 24
Reputation: 485

Post » Fri Jun 27, 2014 5:56 am

Ooops! Sorry, I used the wrong event for left and right. Did you notice the green arrow in front of the Touch icon? This means its only executed once but the player should continue to move as long as you touch the direction arrow. Please try to change it to "Is touching object", then it should work. :)
Just doubleclick it, then click "Back", select "Is touching object" and then confirm with the "Done" button.
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
56
S
17
G
6
Posts: 748
Reputation: 9,420

Post » Fri Jun 27, 2014 10:09 am

Hi,

Thanks for pointing out the difference of with and without green arrow.
I did everything you said but still can't move.
I attach the capx file in here. Would you mind spend a little time to see what is wrong?
Thanks again!
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 24
Reputation: 485

Post » Fri Jun 27, 2014 10:23 am

Fixed.

testing.capx
You do not have the required permissions to view the files attached to this post.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Fri Jun 27, 2014 11:17 am

Thanks, Minor!
It works. I didn't know it should set touching to the playerbox instead of the player.
But the player always face right now. I have set the mirrored when press left on keyboard, I guess I should add an "Or" event for touch input too.
Thanks!

To: Bl4ckSh33p
I don't know if you got my private message? about the 5 Euro.
How can we contact by email when I can't use PM?
Cheers!
B
7
S
1
Posts: 24
Reputation: 485

Post » Fri Jun 27, 2014 11:35 am

I have a comment, not related to your question, but that I believe is a valid point to improve your game. Stay away from an absolute joystick for this platform game of yours, Touch screens have no tactile feedback, so it's very easy for the player to "lose" the arrows positions.

A touch relative joystick, that is, a joystick that anchors itself where the player touches, might be a better choice. It's easy to implement and your players will have a far better experience. :)

If you have any problem implementing such a controller, just PM me or tag me in a thread and I could walk you through. :)
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
20
S
6
G
2
Posts: 620
Reputation: 3,492

Post » Fri Jun 27, 2014 11:51 am

brunopalermo wrote:I have a comment, not related to your question, but that I believe is a valid point to improve your game. Stay away from an absolute joystick for this platform game of yours, Touch screens have no tactile feedback, so it's very easy for the player to "lose" the arrows positions.

A touch relative joystick, that is, a joystick that anchors itself where the player touches, might be a better choice. It's easy to implement and your players will have a far better experience. :)

If you have any problem implementing such a controller, just PM me or tag me in a thread and I could walk you through. :)


Thanks brunopalermo for your valuable suggestion and thanks everyone's fast responses.
I don't want to bother everyone too much with simple beginner's questions.
May be there's a tutorial somewhere you can show me the link to it?

Really thanks everyone for helping me out.
I'm a graphic designer based in Hong Kong. If there's anything I could help(even not design related), please don't hesitate to let me know.
B
7
S
1
Posts: 24
Reputation: 485

Post » Fri Jun 27, 2014 12:01 pm

Facing correct direction fix.

testing (1).capx
You do not have the required permissions to view the files attached to this post.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests