This tutorial will cover a simple way to add touch screen controls for a platform game without adding a touch screen gui.
For the sake of simplicity I used the excellent asset from Kenney.nl
Which includes a C3 project file.
This is what the project wound up including.
I stuck to just the two original layers.
On the start of the layout we can check that the user will need to use touch. It's pretty much up to you as far as that goes. Obviously mobile exports won't need this step. We can also start a min tutorial telling the user what to do.
Rather than adding a clunky onscreen control pad we can move the player by telling it to move when the touch is ether in front of it or behind it. Basically while in touch, if the touch x is greater than the player, move right. Less than, move left.
Now to simulate a jump we tell it that while the first touch, touch index 0 is engaged, it can jump if the second touch, touch index 1 starts.
To continue our little tutorial we can tell it to display a symbol for the second touch when the player comes to a place where it needs to jump.
Comments
Post a Comment