Delay

Description

The delay() function makes Gizmo pause for a specific amount of seconds. Use this function to introduce deliberate pauses in your code execution.

Syntax

delay(seconds)

Parameters

  • seconds: An integer representing the number of seconds to pause.

Return

This function does not return a value.

Examples

Here's an example of how to use the delay() function:

print("Gizmo is about to wait...")

# Make Gizmo wait for 3 seconds
delay(3)

print("Gizmo has finished waiting!")

# Use delay in a loop to create a simple timer
for i in range(5, 0, -1):
    print(f"Countdown: {i}")
    delay(1)

print("Countdown finished!")

This example demonstrates how to use delay() for a single pause and how to create a simple countdown timer.

Notes

  • The delay() function becomes available at level 5 (UnlocksAtLevel: 5).
  • The delay is measured in seconds, and the parameter should be an integer.
  • Use this function carefully, as it will pause the execution of your entire script.
  • delay() can be useful for timing actions, especially when dealing with barriers or other time-sensitive elements in the game.