OVERVIEW:

The Enemy object has 4 animation sequences. The first is the Walking animation, the only animation the user will ever see. The 2nd, 3rd and 4th animations are the embedded detectors, which we will switch between to test for collisions.
It is important to understand that MMF2 executes events sequentially and only updates the screen after the final event has been read. This means that we can switch animation as many times as we like and providing we switch back to the original animation, the user will never see the object change.
Our collision testing process will work like this:
1. Switch to Left Detector animation.
2. Check for collision. If one has occured, walk right.
3. Switch to Right Detector animation.
4. Check for collision. If one has occured, walk left.
5. Switch to Ground Detector animation.
6. Check for collision. If one has not occured, move Enemy down 1 pixel.
7. Switch back to Walking animation.
2. Check for collision. If one has occured, walk right.
3. Switch to Right Detector animation.
4. Check for collision. If one has occured, walk left.
5. Switch to Ground Detector animation.
6. Check for collision. If one has not occured, move Enemy down 1 pixel.
7. Switch back to Walking animation.
When you change animation, the sequence always begins from the first frame. Therefore we need to store the frame number of Walking before we change animation. This way, we can resume it from the same spot.
Hold the left arrow to view the Left Detector animation.
Hold the right arrow to view the Right Detector animation.
Hold the down arrow to view the Ground Detector animation.
The defaut direction is set to both left and right, in which case MMF2 will pick a direction at random.
ALTERABLE VALUES:
| Alterable Value | Default | Description |
|---|---|---|
| FrameSave | 0 | The stored animation frame number. |
3