Level 12 Lesson 02 [Guided Challenge]

Introduction
Lets get the ghosts moving around the grid using the concepts of collision detection, scripts, and lists.

Guided Challenge
For the three parts of the lesson that follow: watch the video and take notes on the basic ideas so that you will be able to apply them to your grid game that you set up in the last lesson.

Part A – Ghosts Moving Forward
Watch the video: 12-02-A
This part demonstrates creating a script to check if it is OK for a ghost to continue moving forward in the grid.


Part B – Detecting Intersections

Watch the video: 12-02-B
When game pieces are at an intersection, they might decided to turn or continue going straight. In this part we take a look at writing a script that will determine whether or not we are at an intersection.


Part C – Pick New Direction

Watch the video: 12-02-C
Our ghosts turn under two conditions: they can’t move forward or they detect they are at an intersection. We have written scripts to realize both of these situations. Now lets write a script that will pick a good, valid, new direction for movement!

Guided Challenge Solution
The video solution is basically Part A, B, and C together.
Solution File: 12-02-C-Done.gmk (contains A, B, and C done)