The Daily Click ::. Forums ::. Klik Coding Help ::. Creating a boomerang
 

Post Reply  Post Oekaki 
 

Posted By Message

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
9th March, 2013 at 09/03/2013 20:36:48 -

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:

Image

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!

Edited by -Liam-

 
Image

Tell 'em Babs is 'ere...

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
10th March, 2013 at 10/03/2013 05:04:12 -

Quick and dirty reply...

- 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.

 
n/a

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
10th March, 2013 at 10/03/2013 11:55:05 -

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..?

 
Image

Tell 'em Babs is 'ere...

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
10th March, 2013 at 10/03/2013 21:59:33 -

I wouldn't use the built-in movements at all.

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.

I don't have time to make an example though.

 
n/a

nim



Registered
  17/05/2002
Points
  7234
10th March, 2013 at 10/03/2013 22:49:12 -

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?

 
//

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
10th March, 2013 at 10/03/2013 23:27:15 -

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.

Edited by -Liam-

 
Image

Tell 'em Babs is 'ere...

nivram



Registered
  20/07/2006
Points
  171
11th March, 2013 at 11/03/2013 15:25:36 -

I have a boomerang example on my website. You can move around and it will still return.

Links:
http://castles-of-britain.com/mmfexamples-a.htm

Marv


 
458 MMF2 & CTF 2.5 examples and games

http://www.castles-of-britain.com/mmf2examples.htm

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
12th March, 2013 at 12/03/2013 18:01:40 -

http://community.clickteam.com/showthread.php?t=72119

You can use this to get the rope working.

 
Craps, I'm an old man!

nim



Registered
  17/05/2002
Points
  7234
13th March, 2013 at 13/03/2013 07:40:59 -


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.

 
//

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
13th March, 2013 at 13/03/2013 15:03:10 -

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

 
n/a

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
14th March, 2013 at 14/03/2013 00:01:00 -

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.

 
Image

Tell 'em Babs is 'ere...
   

Post Reply



 



Advertisement

Worth A Click