Maybe this is easy but... I cannot figure it out.
PixelPun
Member Posts: 324
I am trying to find a way to have one actor stick to another. The only way I can think to explain what I am trying to do is this... Imagine a ball actor that bounces between a ceiling and a floor at a constant speed. What I need to happen is for this ball actor to stick to a vertical line actor so that it does not bounce all over the place while maintaining its speed... and while the player controls the line's horizontal movement....so the ball actor is using it as a track and the ball can hit a target while going up and down. What can I do to achieve this?
Thanks for the help...
Thanks for the help...
Comments
if instead you want the ball to go to the same angle as the line (so is not a line always like this | but it can get like \ or / and other different angles), gamesalad makes this pretty easy, since there are the Move behaviour or the Change Velocity behaviour (they didn't took one or both of them away in 0.9 right?).
You can do something like :
in the line actor -> create a scene or global variable and constrain (or just set when you need it, like when you move the line actor for better performance) that variable to the rotation attribute of the line.
Than, in the ball actor, just make a move behaviour, or a change velocity behaviour, and set that attribute as the angle to move towards. That way, the ball will move at the same angle of the line.
Hope this helps, if you want oyu can drop me an email at hachisoft at hotmail dot it
Then in the Line actor
Constrain Attribute
--game.lineposition.x to self.position.x
Then in the ball actor
Constrain Attribute
--self.position.x to game.lineposition.x
Then setup any other rules to move the line based on button presses or whatever and you can setup your up and down movements however you like also.