Swing Copters...From The Ground Up

3

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

16,679 visits, 37,962 views

Tools

Translations

This tutorial hasn't been translated.

License

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.

Published on 11 Aug, 2017. Last updated 19 Feb, 2019

Group: Player Blink

In this group we want to set a local variable every 1.5 seconds to and integer random number from 0 to 3. If this number is 1, then we want to play the blink animation.

Create the event System: Every X seconds. Interval (seconds) = 1.5 seconds.

Select this event and hit V on the keyboard to add a local variable. Name it Blink.

For the action, set the Blink variable to an integer random number from 0 to 3.

Create another event which compares the Blink variable. This must equal 1.

The actions for this event are:

-obj_Player start animation from beginning

-obj_Player set the animation speed to 5

Group: Scoring

When the player passes between the girders, we want to add 1 to the current score. We can achieve this by comparing obj_Girder's Y position with obj_Player's Y position.

Select obj_Player from the Projects panel or from the Game layout and take a look at its Y position. This value will never change throughout the game.

The girders travel from top to bottom, thus giving us a change in the Y position. Moving from top to bottom increases the Y position. So, if the girder's Y position is greater than the player's Y positon, then we add 1 to the current score.

The girder's origin is set to the center, while the player's origin is set to the bottom center. We will have to add around 18 pixels to the obj_Player's Y position so that it actually passes the top of the girder. The girder's Y position will then be always greater than the player's Y position. This will cause the score to keep adding up. To fix this, we will have to add a second condition, Trigger once. This will ensure us that the condition will only be executed once while true.

The 2 conditions in 1 event block:

-obj_Girder: Compare Y, and comparison is greater than obj_Player.Y 18

-System: Trigger once

The actions:

-Add 1 to the Global variable Score

-Set spf_Score text to the Global variable Score

-Play the audio file point

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • 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.

    youtube.com/watch

    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"

    Thank you.