Converting keyboard controls to touch controls
Hi guys,
I am truly stuck...
I have finished everything on my first app except for the conversion of the controls from keyboard, to touch. I thought this was going to be relatively easy, but its proving to be the thorn in my side.
My game is a platformer.
So my hero character has a nice arc in his jump, moves left and right, falls when he misses a platfrom, etc.
However I CAN NOT figure out how to get all this to work with the touch controls. I've watched heaps of videos but they all only tell you how to make an actor move with an arrow or similar.
I have a left and a right button for moving, and a jump button for jumping.
Can anyone tell me if there is a way of converting all the keyboard controls which work perfectly, to touch?
Thanks in advance for your help!
Comments
Make left_touched, right_touched and jump_touched attributes and inside the button actors, have a rule that says, when touch is pressed, change attribute "whatever_touched" to true and else change attribute "whatever_touched" to false.
In your character, have a rule that says:
when attribute "left_touched" is true, then do left movement
and so on
Below is a video tutorial that shows what @A_Constantin describes:
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Thanks @A_Constantin and @jamie_c, I will give this a go!
Hey @jamie_c , I went through your tutorial video, and the touch controls for the hero are working, but I cant figure out how to set up the jump for the jump button.
I tried opening the jump button actor and changing attribute for the hero actor in the same way you did with the left an right buttons but the hero isnt even an option.
Any suggestions?
If anyone has a demo project of a touch controller that can make an actor jump in an arc I'd love to see it please!
Never mind! I figured it out!
Thank you both for your help
@Chr0nos, cool, glad you got it!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Hey @jamie_c , I have encountered a new problem with my touch controls.
When using the keyboard, jumping left or right is not a problem...the hero jumps in a nice, neat arch.
However, when using the touch controls, (by using the mouse to click on the move right or left control and then using the keyboard to jump) the hero actor won't jump in an arch at all.
Do you have any idea if this will be how it is when the game is running on an iphone?
Sorry, I know its hard for you to predict something like that, I'm just out of ideas, and this is a game-breaking problem.
Thanks in advance!