Skip to content

Instantly share code, notes, and snippets.

@terrehbyte
Last active January 9, 2018 18:56
Show Gist options
  • Save terrehbyte/6c0248273f63b2cf49bbc0f1e68111d1 to your computer and use it in GitHub Desktop.
Save terrehbyte/6c0248273f63b2cf49bbc0f1e68111d1 to your computer and use it in GitHub Desktop.

Co-routines

Closed

Counting to X

Create a simple script that prints all of the whole numbers from 0 to a given number, such as 10. This should be conducted within a coroutine as opposed to running it within an update message in a regular script.

Hint
Remember that you can print messages to the console by invoking the logger using the static members of the Debug class such as Debug.Log.

Open

Scaling Up

Create an object scales up upon instantiation from its current size to its desired size. Your script should expose a field to control the desired scale that the script should scale the object to as well as the amount of time it should take to occur.

For example, your designer may want to create a game where objects fall from the sky and start increasing in size when they hit the ground. The scaling process should be gradual and occur over a span of time.

Timed Disappearance

Create an object that triggers a countdown before it disappears. The countdown should begin when the player collides with the object.

Try adding this to parts of your level so that there may be sections of the level that requires players to wait or survive a set of traps for a period of time before continuing to progress through the game.

Challenge

Vanishing Block

Create a block that phases in and out of existence, at times being visible and collidable while at other times being invisible and untouchable.

Consider incorporating this into sections of your game level in order to create timed portions that require the player to quickly move through.

Timed Bomb

Modify the object you created for the timed disappearance task to explode at the conclusion of its timer. The bomb should apply physics forces to the objects within its vicinity to simulate them being affected by an explosion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment