I'm looking to create a boomerang style power-up. I'd like it to travel in a slight arcing movement and must always return to the players position fairly quickly. To make things more difficult though, I'd like this boomerang object to be attached to a rope which the player holds. Here's a visual example of the movement:
What's the best way to go about doing this? If the rope attachment is too difficult I guess I can leave it out.
Sorry for spamming the forum with questions lately! Thanks for any help!
- Create a path movement for the Boomerang, and make sure that at the end of the movement the boomerang's direction is facing towards the Player. If you want to be really fancy, add in a second movement to the boomerang like Bouncing Ball, and then it will find its way back to the player.
- For the rope, create a small object whatever colour you want the rope to appear as; have it centered on the Player and Always facing the boomerang. If the Rope and the Boomerang are not overlapping, then increase the scale of the object (either x or y axis, I can't recall which but if it's horizontally-oriented you'll want to increase the x-axis) by 0.01 or 0.1, or some other small number. Also set your events so that the scale of the object will constantly shrink if the object is already overlapping the boomerang, so your rope will "retract" once the boomerang is on the return trip.
Hope this is helpful. I'm not able to make an example for you at the moment, but it sounds like fun to tinker with.
Thanks s-m-r. I'm not sure what you mean about adding Bouncing Ball as a secondary movement to the Boomerang. Would it be switching movements when the Path has finished, then "Always" move it's position to the player? Something like that..?
You can create a really smooth movement using the sin function for the y movement and control the x movement by using an acceleration variable.
It would just look smoother, and be easier to tweak.
Can you give us a bit more information? For example, can the player still move while waiting for the boomerang to come back? If it's on a static curve (path or sine movement) it'll go back to where you threw it from even if you're not there anymore. And the rope - just a straight line or do you want rope physics or something?
Thanks guys. To answer your question nim, yes I'd like the player to be able to move around after throwing the boomerang. I actually don't need a rope attached to it, but was just curious about how you could do it if I ever decided I wanted to do it in the future.
Also don't worry about not having an example! I'm quite happy to experiment myself. I'd probably come back here with problems a few times though. I'll fiddle around with the sin function tomorrow.
Originally Posted by -UrbanMonk- I wouldn't use the built-in movements at all.
Honestly, I would use a built-in bouncing ball movement for this. Gradually decrease its speed and when it reaches 0 set a flag and reverse it/increase its speed. It won't make a nice little arc without some extra coding but it's easily the simplest solution.
I'd just use standard 360 degree shooting to fire the boomerang away, and then apply a constant force to push it back towards the player (just like thrusters in an Asteroids clone).
eg. http://sdrv.ms/Z1CYYp
Thanks for all the responses, everyone! I've had a look at both example mfa's here and they're great! I'll play around with force/bouncing ball to try and get some gradual acceleration to the boomerang, too.