Keep actors from moving with collision!
iPhoneDevForMe
Member Posts: 362
I've spent a day or so trying to make this work, but im stuck.
I have an actor that moves left to right based on input from the accelerometer. Lets say it is called ship. An invisible actor is constrained to the ships x position so it follows the actor. This actor could be called collision.
When you press the screen it changes a boolean game attribute called move to true and change to false if touch is released.
Another actor on the screen called orb has a rule that states when the actor collides with my invisible actor called collision and if move is true, then move towards the ship. (in other words touch the screen when the ship is near an object and the object will move toward the ship)
My problem is the ship actor continues to move and if my invisible actor collides with another orb it starts to move towards the ship as well. While one orb is moving towards the ship, I dont want any other orbs to be able to move at the same time if they collide with the invisible actor.
I have tried many ways to keep this from happening without much luck! Any idea's? If this does not make since I can maybe email someone the prototype and see what they come up with?
If I cant make that work, what can I do to make the ship stop moving while the screen is being touched?
Thanks in advance
I have an actor that moves left to right based on input from the accelerometer. Lets say it is called ship. An invisible actor is constrained to the ships x position so it follows the actor. This actor could be called collision.
When you press the screen it changes a boolean game attribute called move to true and change to false if touch is released.
Another actor on the screen called orb has a rule that states when the actor collides with my invisible actor called collision and if move is true, then move towards the ship. (in other words touch the screen when the ship is near an object and the object will move toward the ship)
My problem is the ship actor continues to move and if my invisible actor collides with another orb it starts to move towards the ship as well. While one orb is moving towards the ship, I dont want any other orbs to be able to move at the same time if they collide with the invisible actor.
I have tried many ways to keep this from happening without much luck! Any idea's? If this does not make since I can maybe email someone the prototype and see what they come up with?
If I cant make that work, what can I do to make the ship stop moving while the screen is being touched?
Thanks in advance
Comments
Always use booleans!
Hope this helps