The move()
function makes Gizmo travel in a specified direction. This function consumes energy and returns false if the movement fails.
success = move(direction)
direction
: An integer representing the direction to move. Use the MoveDirectionEnum
:
The function returns a boolean:
True
if the movement was successful.False
if the movement failed (e.g., due to an obstacle or insufficient energy).Here's an example of how to use the move()
function:
# Try to move Gizmo forward
success = move(MoveDirectionEnum.Forward)
if success:
print("Gizmo successfully moved forward!")
else:
print("Gizmo couldn't move forward. There might be an obstacle or insufficient energy.")
# Move Gizmo in a square pattern
for direction in [MoveDirectionEnum.Forward, MoveDirectionEnum.Backward]:
if move(direction):
print(f"Moved successfully in direction: {direction}")
else:
print(f"Failed to move in direction: {direction}")
This example shows how to move Gizmo forward and how to create a simple pattern of movements.
move()
function is available from the start of the game (UnlocksAtLevel: 0).