Swing Copters...From The Ground Up

Index

Attached Files

The following files have been attached to this tutorial:

.zip

swing-copters-assets.zip

Download now 195.54 KB
.capx

swing-copters.capx

Download now 328.31 KB

Stats

3,369 visits, 7,796 views

Translations

This tutorial hasn't been translated.

Tools

We will now create a For loop. Create within the On start of layout event another sub-event. Select System: For. Give this loop the name "Obstacles" (don't forget the quotation marks). Set the Start index to 0 and the End index to 3. This gives us a total of 4 iterations. Add a local variable and name it HammerAngle.

When the hammers are created, we want them to start swinging from different angles, otherwise all the hammers will look the same.

Select the For loop and add the Create object action.

-System: Create object

-Object to select: obj_Girder

-Layer: "Enemies"

-X: int(random(-180,-30))

-Y: -172 (loopindex*-280)

Int will make the random number an integer number (e.g. -90, 25, -2 etc.). Loopindex holds the current iteration, starting at 0. -172 (loopindex x -280) is -172 (0 x -280) which equals -172.

Add the following actions:

-obj_Girder: Spawn another object. Object to spawn obj_Hammer on the "Enemies" layer at image point "Right".

-obj_Hammer (Sine): Set cycle position. Set the value to the local variable HammerAngle.

-obj_Hammer: Set angle of motion. Set the angle to 90 degrees.

Now repeat the above steps for the second hammer. Start by creating another hammer. Spawn the second hammer from image point "Left".

When you are done you should end up with this.

Save the project.

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!