The delay()
function makes Gizmo pause for a specific amount of seconds. Use this function to introduce deliberate pauses in your code execution.
delay(seconds)
seconds
: An integer representing the number of seconds to pause.This function does not return a value.
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.
delay()
function becomes available at level 5 (UnlocksAtLevel: 5).delay()
can be useful for timing actions, especially when dealing with barriers or other time-sensitive elements in the game.