Left and right touch controls
Hello there,
I have tried this by myself but it don't works as i want it to. when I press on the half right side on the screen the actor goes right and left the same. But If i press the right side as an example when left is already pressed it don't works and same with the right. It's like it does not Recognize it.
My rules:
when mousebutton is down and mouse position is < 240 go right. when mouse button is down and mouse position is > 240 go right.
What am I'm doing wrong? I want it to move even when the you have two fingers on the screen.
Thanks,
Fredrik
I have tried this by myself but it don't works as i want it to. when I press on the half right side on the screen the actor goes right and left the same. But If i press the right side as an example when left is already pressed it don't works and same with the right. It's like it does not Recognize it.
My rules:
when mousebutton is down and mouse position is < 240 go right. when mouse button is down and mouse position is > 240 go right.
What am I'm doing wrong? I want it to move even when the you have two fingers on the screen.
Thanks,
Fredrik
Best Answer
-
The_Gamesalad_Guru Posts: 9,922
Checkout this thread tshirt posted a template that will get you started. http://forums.gamesalad.com/discussion/comment/327533/#Comment_327533
Answers
Go to templates and download the jump controls. How it works is left and right movement and when you have say right pressed and press left it will issue a jump command. Same basic idea and you don't have to use the jump part.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I can send an image of my rules:
This is the right actor.its a invisible actor thats is on the right half of the screen. I have a left actor also that is the same only that I have swapped the "constrain attribute". It works with just change attribute also I just tested me around a little bit
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I just want my actor to move to where the latest touch is pressed NOT to where the first touch is pressed
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Any ideas someone?
you are trying this with a mouse down condition …
a desktopComputer responds to each mouse/touch as a separate condition
the devices have multiple touch conditions
for actual gamePlay to verify that user is touching with another touch on screen
… you will have to code that way and test with GS Viewer or in an ad hoc build
in your image of Rules… when touch is pressed
it is only constraining when touch is active
thus when touch is released the Otherwise: section of the rule triggers
try:
- gameAttribute for touchState (touch is R or L) … index type … 1 = R; 2 = L
on sensorActor
Rule: when
Event: touch is pressed
-Rule: when
-Attribute: touch1.Position.X > 240
-changeAttribute: touchState To: 1
-Otherwise:
--changeAttribute: touchState To: 2
Otherwise:
changeAttribute: touchState To: 0
on the actor that the touch is controlling
have a Rule for each touchState (0; 1; 2)
quick look/see demo: http://www.mediafire.com/?pgcdcb0pwtfvrki
@};- MH
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS