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.
So this is the star of my code..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.
if (distance_to_object(obj_player) > 75)
Ok, thanks. Im going to play around with it some more and see what I come up with. Appreciate your helpI 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>Code:if (distance_to_object(obj_player) > 75)
I'm a GML noob, so take this with a grain of salt.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.
Thanks for the tip. I appreciate the help.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. Ill check it outhere you have a youtube tutorial for boomerang