Project 196: Dodgy Road

4. Game Setup

Build Variables to keep track of the game, and the first Collision with the enemy! We'll call them Level, Path, and Frequency.
Starting point file for this challenge

Your goal

Steps

1. Create Variables to control our game.

We need variables to keep track of the level, how often enemies appear, and which path enemies take.  Before we worry about using them  we have to make them in the "Variables" tab on Scratch.  Our three variables will be named: Level, Path, and Frequency

2. Put the Character at the Starting Point.

We will place our character at the bottom center of our screen using the "go to x: __ y:  __ " block from motion.  Make "x: 0" and "y: -150". 

3. Include the Level and beginning Frequency

Let's add two "set variable to 0" to the "when green flag clicked" block.  Then switch them so one sets the frequency and the other the level.

4. Set the variable values

Then we will set frequency to 2 and level to 1 using the blanks in the "set ____ to 0" blocks we just added.

5. Add a Forever Loop and If Then statement to respond to Sprite Collisions

Add a "forever loop" from Control to run the first collision detection.  The place an "if then" block inside and use the "touching mouse pointer" block as the condition.  

6. Heading back to the start.

Let's adjust our condition to select the enemy! Switch the "touching mouse pointer" to "touching Enemy". Finally add the correct motion code to send our character back to the beginning.  We want to be careful to use the same "go to x: 0 y:-150" block from earlier.