I need a Boomerang!

I

IE Entertainment

Guest
Hey, guys. I am in need of a boomerang mechanic. I currently have a projectile that shoots from the player but I want it to act as a boomerang and return to the player. Any suggestions? Thanks, guys in advance.
 
D

drowned

Guest
Maybe in the boomerang's step event, check the distance it has traveled since being thrown (and store its starting point in the create event). Then when it has flown sufficiently far, lower its speed incrementally until it hits zero, then slowly increase it in the other direction until it returns to the player.
 
I

IE Entertainment

Guest
Maybe in the boomerang's step event, check the distance it has traveled since being thrown (and store its starting point in the create event). Then when it has flown sufficiently far, lower its speed incrementally until it hits zero, then slowly increase it in the other direction until it returns to the player.
So this is the star of my code..
//Boomerang Mechanic
if (distance_to_object(obj_player) > 75)
{

}

So I need to slowly reduce its speed and bring it back to the player position?
 
D

drowned

Guest
Code:
if (distance_to_object(obj_player) > 75)
I would not do it this way because if the player is walking towards or away from the boomerang it will fly inconsistent distances. I'm thinking, in the create event store the starting x point, like StartX = x. Then in the step event check to see if x - StartX > <distance you want it to fly before slowing down and returning>
 
I

IE Entertainment

Guest
Code:
if (distance_to_object(obj_player) > 75)
I would not do it this way because if the player is walking towards or away from the boomerang it will fly inconsistent distances. I'm thinking, in the create event store the starting x point, like StartX = x. Then in the step event check to see if x - StartX > <distance you want it to fly before slowing down and returning>
Ok, thanks. Im going to play around with it some more and see what I come up with. Appreciate your help
 
B

Bomb The Moon

Guest
Hey, guys. I am in need of a boomerang mechanic. I currently have a projectile that shoots from the player but I want it to act as a boomerang and return to the player. Any suggestions? Thanks, guys in advance.
I'm a GML noob, so take this with a grain of salt.

in the projectile's step event, reduce the speed at which it is moving away from you, until it stops moving, then increase the speed at which it heads back to the player, until it reaches the desired speed.
you should be able to accomplish this with some "if" statements that check the speed of the projectile and then act on it accordingly.

hope this helps.
 
I

IE Entertainment

Guest
I'm a GML noob, so take this with a grain of salt.

in the projectile's step event, reduce the speed at which it is moving away from you, until it stops moving, then increase the speed at which it heads back to the player, until it reaches the desired speed.
you should be able to accomplish this with some "if" statements that check the speed of the projectile and then act on it accordingly.

hope this helps.
Thanks for the tip. I appreciate the help.
 
Top