Creating a Breakout Game: Technical Exercises
REVIEW OF RELEVANT LINGO TERMINOLOGY:
Conditional statements:
if
.(some condition is true) then
do this
end if
Properties: intersect
Example:
This statement checks whether two sprites intersect and, if they do, changes the contents of the field cast member Notice to "You won."
if sprite i intersects j then
put "You won." into field "Notice"
end if
Commands: repeat with, repeat while
Examples:
This frame behavior script continually changes the opacity of sprites 1-30.
on exitframe
repeat with channel = 1 to 30
sprite(channel).blend=random(100)
end repeat
end
TECHNICAL EXERCISES:
- 1) Create a single frame movie 640 x 480 pixel stage size. Place at least 20 "bricks" (vector cast membes) on stage in channels 1 through 20. Now use a repeat loop to change the colors of the bricks on stage continually.
- 2) Create a single frame movie 640 x 480 pixel stage size. Place at least 20 "bricks" (vector cast membes) on stage in channels 1 through 20. Create a circular sprite and place in channel 25. Make the circular sprite follow your mouses position on stage. Now have the bricks disappear when your circular sprite touches, or intersects them.
- 3) Import 5 short (less than 2 seconds) sounds into your movie that you made for Exercise #2. Whenever the circular sprite intersects a brick, write a script (use a list) to puppet one of these five sounds randomly.
- 4) Create a paddle and a breakout ball. Place at the bottom of the stage and script the paddle so that its locH corresponds to the balls lochH. You are now going to create a four frame movie that will move the ball around the frame of the movie as if it were bouncing off the edges. To start you off, create four markers: put "upleft" at frame 10, "upright" at frame 20, "downleft" at frame 30 and "downright" at frame 40. The marker names correspond to what you are going to need to make the ball do (in lingo) in that frame. For example, in the marker titled "upleft" the ball will need to move up and to the left, heading for the left bumper. You will need to incorporate if-then statements to send the playback head to a different frame if the balls locH is less than zero, or if it travels beyond the left edge of the movie bounds.