Hey all. This is my first tutorial, let's see how it goes. I picked a fairly simple but extremely efficient topic: the boomerang.

First step is obviously to create an active object that acts as our boomerang. It's surprising how effective four rotated frames of an original boomerang frame can be at a high speed. We also need to create the object that will be shooting the boomerang...most likely our main character. I will refer to it as the shooter.

Next, give the boomerang bouncing ball movement and give the shooter, preferably, eight direction movement. It will of course work with platform movement, but boomerangs become much more fun with eight directions.

So what we want to do is allow this active object to shoot from us, go a certain distance away and then return to us, no matter where we happen to be on the screen. As an added bonus, we'll make sure we can't shoot another boomerang until the boomerang has returned to us. We'll need to keep track of two flags, one for the shooter that lets the program know whether a boomerang has been shot and one for the boomerang that lets the program know if it's on its way out or on its way back.

So, on with the events:

Start of frame --> Destroy Boomerang
Shooter: Internal Flag 0 is off
+ Upon Pressing Space Bar --> Shoot Boomerang at Speed 50
+ Turn Shooter's Internal Flag 0 on

So now we can shoot a boomerang, and we know that we've shot one so we can't shoot another. Next, we need to make the boomerang come back to us after its gone a certain distance. I've chosen 150 pixels...you can choose what's best for you.

Sqr( ( ( X( "Shooter" ) - X( "Boomerang" ) ) * ( X( "Shooter" ) - X( "Boomerang" ) ) ) + ( ( Y( "Shooter" ) - Y( "Boomerang" ) ) * ( Y( "Shooter" ) - Y( "Boomerang" ) ) ) ) > 150 --> Turn Boomerang's Internal Flag On.

In that rule, I've used trigonometry to effectively create a 150px radius circle around the shooter, and if the boomerang steps outside the circle, the boomerang's flag turns on, signifying that it's time to go home, as we'll see in the next few events:

Boomerang: Internal Flag 0 is On --> Look at (0,0) from Shooter

Boomerang: Internal Flag 0 is On
+ Collision Between Boomerang and Shooter --> Turn Shooter's Internal Flag 0 Off + Destroy Boomerang

In the first rule, I set the boomerang to always go in the direction of the shooter so that the shooter can actually run from the boomerang and the boomerang never gets lost. Then, if the boomerang is heading back and collides with the shooter, the shooter will now be able to shoot again and the boomerang is destroyed.

There are some more things that you can do that would improve the boomerang. If the boomerang leaves the play area, you should probably turn its flag on so that it comes back. Same for when it hits walls, blocks, enemies, etc. Also, an interesting use for the boomerang is item retrieval. When the boomerang hits an item that you want to come back to you, turn one of the item's flag on and then create a new event that says that when the item's flag is on, its position should be (0,0) relative to the boomerang.

That's about it. It's pretty simple stuff, but it works really well and I'm sure it'll be useful to at least one person.