Boomerang

Hi Guys,

I am adding a new weapon to my character in my platform game... I want to add in a Boomerang. I have been searching the forums, but most of the Boomerang examples are no longer available. What I am looking for is when the user presses a button, I would like the character to throw the Boomerang...and have the Boomerang go about 300pixels then return to the character position even when moving. Do any of you have any examples or ideas on how to best approach this?

Thanks

Comments

  • jay2dxjay2dx Member Posts: 611
    edited January 2016

    Constrain the players X and y to game attributes, now when you throw your boomerang "I'm assuming you know this bit!" Either way have the boomarangs motion X change to say 400 now set a timer or use self time on the boomerang and after about 1.5 seconds have a rule in the boomerang that interpolates its X and y position to the constrained player X and y game attributes! And have it destroy when it touches the player, there's plenty of tutorials about constraining attributes on the forums so have a look if unsure.

    Let me know if this helps, I'll make you a demo if your still stuck

  • imjustmikeimjustmike Member Posts: 450

    Might be worth playing around with an accelerate behaviour rather than an interpolate as it would look smoother.

    Also, instead of a timer you could also use magnitude function to work out how far the boomerang is from the player to control when it comes back. Though that might be over kill it's only moving in a straight line - can instead use a rule to see if the boomerang.x is great that hero.x +/- X where X is the distance you want the boomerang to travel from the player.

  • imjustmikeimjustmike Member Posts: 450

    I made a very rough demo for you. Probably many better ways to do it, but had a spare ten minutes. Click the hero (your avatar) to throw the boomerang. It'll return and stop moving. You can change pretty much everything (how far it moves away, how quickly etc) by playing around with the rules and the behaviours. Have fun.

    https://www.dropbox.com/sh/av9n5irud9fezah/AADHMkg3Jf0AMyHZ2HvNREuIa?dl=0

  • quinn221quinn221 Member Posts: 280

    Thanks guys I will try all of these ideas!

  • quinn221quinn221 Member Posts: 280

    @imjustmike I tried to open the file but it says it is corrupt. Can you try to save it out again and dropbox it to me. I am on a Mac, and I even tried opening it on a PC...but had no luck. Is it possible to export it for mac as well?

    Thanks for your help on this!!

  • quinn221quinn221 Member Posts: 280

    @imjustmike So I have it almost working...it maybe conflicting with my other weapons....right now I can throw the Boomerang and it comes back but it just bounces off of me and flys away again...I can also throw more than on at a time....
    Do you mind looking at an example of how I have my weapons set up...maybe you can figure out what I am doing wrong.

  • imjustmikeimjustmike Member Posts: 450

    Sure. Share a link to your project and I'll take a look.

    FYI - these are the rule + behaviours that make the boomerang stop in the example I used:
    image

  • quinn221quinn221 Member Posts: 280

    @imjustmike said:
    Sure. Share a link to your project and I'll take a look.

    FYI - these are the rule + behaviours that make the boomerang stop in the example I used:
    image

    Thanks..I am going to send you the link in your inbox....as well as what the issues is

Sign In or Register to comment.