"Move to" the location of a another actor without stopping
goubet.patrick
Member, PRO Posts: 9
Hello all !
I use "move to" to move an actor A toward the location of the actor B (which is moving)
Once done the Actor A stop, but I want this actor to continue the movement to go out the screen.
How can I do ?
Comments
one way, instead of move to, use change attribute to set the speed of linear velocity x and y.
Thanks Bob !
I don't understand how by changing the speed the actor A will meet the actor B ?
sorry. I mis-read your question. scrap that suggestion.
so as an example, to see if I am now understanding, you want something like a shot fired at a point in the direction of another? to do that, you can figure out the angle between actor a and actor b, then use the 'move' behaviour, with the direction set to that angle between the two actors.
so in the move behaviour you could set:
in the example of an enemy firing at the player. you would have two global variables that are constrained to the player's x and y position. the above move behaviour would be inside a 'shot' actor, and that shot actor would be spawned from your enemy when the player reaches a certain distance from the enemy (can use the magnitude function to work that out)
Thanks a lot ! I will try this
I think the Accelerate Toward Behavior is persistent, un-like the Move To. You might try that as well.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page