Touch Screen Controls not working but Keyboard Keys Are working
DaGreatness
Member Posts: 82
So, here is a dilemma that i am having. I have a racing car game going and the issue, is when i add the key boards keys to the controls it works perfectly fine. When i am adding the mouse/touch screens (I believe they are the same) it just does not work at all. Here is my setup:
Body (actor)
Left Wheel (actor)
Right Wheel (actor)
All of them are joined and constrained together so they move with the same motion. So if i press the right arrow on the keyboard all of them move in sync to the right.
But i am not sure why it is not working with touch. I have created 2 actors which are the forward and reverser buttons on screen and they are HUD. I have added that to both these attributes that
if mouse is pressed
DO
game.MoveRight is true
ELSE
game.MoveRight is false
and the same for the left but for the MoveLeft attribute.
I know i have to add the if game.MoveRight and game.MoveLeft rules too all 3 of the actors but when i do, they seem to not move, and when i take them out and use the keyboard keys they work.
Please can someone assist with this, because it will help me tremedously!!! Thanks in advance!!!
Body (actor)
Left Wheel (actor)
Right Wheel (actor)
All of them are joined and constrained together so they move with the same motion. So if i press the right arrow on the keyboard all of them move in sync to the right.
But i am not sure why it is not working with touch. I have created 2 actors which are the forward and reverser buttons on screen and they are HUD. I have added that to both these attributes that
if mouse is pressed
DO
game.MoveRight is true
ELSE
game.MoveRight is false
and the same for the left but for the MoveLeft attribute.
I know i have to add the if game.MoveRight and game.MoveLeft rules too all 3 of the actors but when i do, they seem to not move, and when i take them out and use the keyboard keys they work.
Please can someone assist with this, because it will help me tremedously!!! Thanks in advance!!!
Comments
I clicked on the actors on the screen - yes i did that and i made the changes to all 3 of the actors, but still there was no success, but when i add the keyboard keys it still works
It's better practice to just use the prototype actor and try not to unlock your actors in scene. But sometimes you have to anyways.
receive key (right) to pressed
by replacing that to
if game.MoveRight is true (Which in this case its its referring to the actor that i had this setup where the mouse is being used)
the only thing that is not working is, when i click on the actor block where the mouse action is coming from, i am not sure why its not working
does that make any sense?
http://www.sendspace.com/file/fj5nj5
The DO parts work perfectly fine, they are not the issue, the issue is when I am trying to use the mouse down it works when I click on any where on the screen, its not pin pointed to that specific actor, I want it so when I click that actor it moves, and when I click the other actor it moves the other way, right now if I say if game.MoveLeft is true and game.MoveRight is true, it only reads as one thing, and the car wont move because when you click anywhere on the screen it trys to move both ways. Because the mouse is not defining the 2 actor buttons I have
It's and going to be an image but for testing to get it right it's a block for now, the color is white for both, one is on the left screen side and one is on the right screen side like as the controls
https://www.dropbox.com/s/r0k9xf7fe4atq52/move left & right.zip
Hope this helps!
I already have those attributes and everything setup. They are not working for some odd reason. That is why i have this thread open, setting up the variables was the easy part, i am not sure why it is not workin tho
@allc1865 where should i send the file?