Skip to content

A3x - Optional Extensions

These are some extensions you can try if you are ahead of schedule on assignments. If you complete either or both of these, please call me over to show me.

Extension 1 - Collision Detection

Complete this in the Unit 2/a3x1 project.

The template contains two rectangles that are moving towards each other and eventually cross paths. Add code so that while they are touching, the rectangles change colour. When they are no longer touching, they should go back the original colour.

  • Start by just moving the rectangles along the x-axis. Your calculations will have to consider where the right edge of one rectangle is with respect to the left edge of the other rectangle.

  • If you get this working and want to take it a step further, move the rectangles diagonally, and take both the x and y axes into consideration.

Extension 2 - Maze

Complete this in the Unit 2/a3x2 project.

In the template, you'll see the start of a maze program. Get creative and do what you can to extend it. Some possible ideas:

  • Build more walls to make it a full maze (obviously!)
  • You could have a variable that keeps track of health, and decrease any time the ball is touching a wall
  • You could have something happen if they complete the maze
  • You could have some sort of power-up item