Teacher's Guide

Chapter 1 / Level 4: Pushing objects

Teaching Objective:

  • Student understand they can interact with the environment using functions
  • Use critical thinking and selecting paths to navigate
  • Learn how and when to use the push() function

Guide

Some obstacles like rocks will be in your way, use the push() function to push the rocks out of your way.

player.push()

You need to make sure you’re facing the rocks in order to push them, they need to be directly in front of you as you’re looking at them. You can use functions turn_left() and turn_right() to rotate the character left or right to position your character to face the rocks.

player.turn_left()
player.turn_right()

Push rocks out of the way as you make your way to the star in order to complete the level.

Map overview and path

Map overview and path

Code Solution

import player

player.move_forward()
player.push()
player.move_forward()
player.turn_left()
player.move_forward(5)
player.push()
player.move_forward()
player.turn_right()
player.move_forward(3)
player.push()
player.move_forward()
player.turn_left()
player.move_forward(2)
player.turn_right()
player.move_forward(2)
Chapter 1 / Level 4: Pushing objects | Teacher's Guide