How do I change keyboard to touch

Get help using Construct 2

Post » Sat Oct 25, 2014 11:31 am

Hello to all, in my game i have a sprite who move from left to right, the spriet is controlled with just the keyboard, left and right.

now i added the touch object because i would like to test that on android, but how to tell to touch object the keyboard left or right is down?
B
37
S
15
G
7
Posts: 1,680
Reputation: 9,612

Post » Sat Oct 25, 2014 11:52 am

Short answer: you don't.. :)

Just add a new event for the touch controls you want..
Using an "or"-block would probably be too much of a hassle here, because the touch event probably needs conditions to work as expected and this would then conflict with the keyboard event..

You could add the browser object to check if on mobile and put the controls in seperate groups and activate/de-activate when needed, but the way you explain your controls, this wouldn't really help except for making your event-sheet more readable..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Oct 25, 2014 11:57 am

i dont have nothing in my events for the keyboard at the moment, for my moving sprite i just added the 8 directions behaviour, with the directions left-right only :p :D
B
37
S
15
G
7
Posts: 1,680
Reputation: 9,612

Post » Sat Oct 25, 2014 12:02 pm

Something like this should work:

on touch
system compare two values: touch.x>player.x
- player 8 direction - simulate pressing right

on touch
system compare two values: touch.x<player.x
- player 8 direction - simulate pressing left
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Oct 25, 2014 12:20 pm

thanks again :D
B
37
S
15
G
7
Posts: 1,680
Reputation: 9,612


Return to How do I....?

Who is online

Users browsing this forum: cb130felix, Kermad, Lancifer, mongoose665, piddlyPoo, yiuyiu6666 and 3 guests