Hi im trying to make an object fly around the player and move off to attack enemies when they come into range. I only able to set the object to face and move towards the player but the object will stop right at the point of origin of the player.
Can anyone help ?
As always there are multiple ways to do this, some involve a lot of math and some are pretty easy..
Easiest way I would know of is giving the object rotate behaviour, putting the origin outside it's image and pinning it to the player..
when wanting to move it to attack, just spawn a new object with the same animation but different behaviour and destroy the rotating one..
While this is probably the easiest way, it might not be the best performance-wise..
Develop games in your browser. Powerful, performant & highly capable.
I would look into the Pin behavior, the Line of Sight Behavior, as well as the Sine Wave behavior. You should be able to do what you are looking for with those three behaviors and a little elbow grease.