The following files have been attached to this tutorial:
This tutorial hasn't been translated.
This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.
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
-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.
dazedangels We us this counter for the Medal screen. If your score is 10 and you die then on the Medal screen. Start at 0 and increase by 1 every 0.07 seconds until 10 is reached.
Check this vid at 0:36.
Hope this helps.
Why are we creating an event in "Game Over" to add 1 to ScoreCounter every 0.07 if ScoreCounter isn't equal to Score? What is ScoreCounter doing, if the game is over?
"-System: Every X seconds, where seconds is 0.07"