How do I add touch control for my platformer game?

0 favourites
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • 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.

  • 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.

  • 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.

  • 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.

  • 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!

  • Fixed.

    [attachment=0:34mxrkjo][/attachment:34mxrkjo]

  • 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!

  • 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.

  • 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.

  • Facing correct direction fix.

    [attachment=0:2sojp7v8][/attachment:2sojp7v8]

  • Since I had some time now, I made an example...

    You can check it at http://examples.gamesintheattic.com/mariotouch. Or use the QR below, if you don't want to type the whole address in your phone.

    [attachment=0:1mfde3r7][/attachment:1mfde3r7]

    The .capx can be downloaded at http://examples.gamesintheattic.com/testing.capx

    EDIT: It doesn't include the last fix made by Minor, since we were working in parallel, so you'll have to do some merging.

  • What can I say?! Wow! Thanks guys, Bl4ckSh33p, Minor and brunopalermo!

    I didn't expect for so much help and fix in here. Learnt so much in a short time.

    I will definitely make a great platformer!

    Thanks guys! Really really thanks alot!

  • Try this simple touch tutorial game

    https://www.scirra.com/tutorials/794/to ... imple-game

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • chan316 Ah, now I know who it was. Thank you very much for your donation on Indiegogo!

    I sent you a message over their website but I did not get a PM. You can send me an email via > mail [at] bl4cksh33p.de < or use Facebook/Twitter.

  • Try this simple touch tutorial game

    Thanks, I will definitely look into it. I'm still way too fresh at C2.

    chan316 Ah, now I know who it was. Thank you very much for your donation on Indiegogo!

    I sent you a message over their website but I did not get a PM. You can send me an email via > mail [at] bl4cksh33p.de < or use .

    Thank you for your help. I sent you an email, hope you have got it.

    I also added your facebook too. Keep in touch!

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