|
8. Duplicate
the vertical wall and place it on the left side.
9. Choose Modify > Transform >
Flip Horizontal
10. For the floor we want to create another movie
clip.
11. Choose Window > Library >
wall1
12. In the Library duplicate
the wall movie clip and name it as 'wall2'
13. Select frame 3 on Walls layer and drag
wall2 movie clip from the Library
to the stage.
14. Choose Modify > Transform
> Flip Vertical
15. Set the wall2 in such way that the walls create
a complete rectangle.
16.
Double click the wall2 movie clip to go inside it.
17. Insert 4 keyframes upto frame 5
18. On frame 2 and 4 change the color of the
Black patch to Red.
19.
Insert a new layer and at frame 1 assign
the following action
stop();
20. Select frame
4 and choose Insert > Keyframe
21. Select keyframe 4 and choose Window
> Actions
22. In the Actions panel
type the following action:
gotoAndStop(1);
23. Similarly
insert a keyframe at frame 5 and assign
the following action
| tellTarget
(_parent) { |
| |
gotoAndStop(5); |
| } |
// this action will
jump back into the game movie clip and stop at frame 5.
24.
Now go back into game movie clip
1.
Insert a new layer above Walls layer and rename
it as 'Bat'
2. Select frame 3 and choose Insert
> Keyframe
3. At frame 3 create a small Black rectangle
with dimensions of 40px. X
5px.
4. Convert it into a Movie Clip with the top center
Registration point selected
and name it as 'bat'
5. In the Properties
panel type Instance Name
as 'bat'
6. Insert a new layer above Bat layer and name
it as 'Ball'
7. Select frame 3 and choose Insert
> Keyframe
8. At frame 3 create a small Black circle with
dimensions of 7px. X
7px.
9. Convert the circle into a Movie Clip with the center
Registration point selected
and name it as 'ball'
10. In the Properties
panel type Instance Name
as 'ball'
11. Select frame 4 on all layers and choose
Insert > Frame
12. Select frame 4 on the Actions
layer and choose Insert > Keyframe
13. Select keyframe 4 and choose Window
> Actions
14. In the Actions panel
type the following action
gotoAndPlay(3);
// This action helps
the actionscript to run continuously between frame 3 and 4.
For Game Over
we need to create another background.
1. Choose Insert
> New Symbol
2. In the Create New Symbol
type name as 'background3' and convert it into a Movie
Clip.
3. Create a dual
colored patch with dimensions of 150px.
X 280px. and a
curved white line between two colors.
4. Insert a new
layer and type text as 'Highest Score' and
'Previous Score'
5. Choose Window
> Library > game
6. Double click the game movie clip to go inside it.
7. Select frame 5 on Background 1 layer and
choose Insert > Keyframe
8. Select background2 movie clip and in the Properties
panel swap it with background3 movie clip
9. Select frame 5 on Highest and Previous
Score layer
10. Choose Insert > Keyframe
11. At frame
5 shift the score text fields to bottom
and place them in front of respective titles.
12. Insert a new
layer above Previous Score layer and name it as 'Last
Score'
13. At frame 5 insert a keyframe and create a
Dynamic Text Field
14. In the Properties panel
type Variable name as '_root.score'
15. On the same frame type text as 'You Scored'
16. Insert a new
layer above Last Score layer and name it as 'Game
Over'
17. Select frame 5 and choose
Insert > Keyframe
18. With the help of Text Tool
type 'GAME OVER'
19. Select the text,
convert it into a Movie Clip and name it as 'game
over'
20. Double click the game over movie clip to go
inside it.
21. Select frame 5 and choose
Insert > Blank Keyframe
22. Select frame 8 and choose Insert
> Frame
23. Come back into game movie clip.
24. Insert a new layer above Game Over layer and
name it as 'Play'
25. Select frame 5 and choose Insert
> Keyframe
26. Create a button or import any graphic and
convert it into a button. Here we have imported 'play button.png'
graphic. (To import Choose File >
Import)
27. Select the graphic
on the stage, convert it into a Button with the top
left Registration point selected
and name it as 'play'
28. Double click the play button to go inside it and
rename the layer as 'Play'
29. Select frame at 'Hit'
stage and choose Insert > Frame
30. Insert a new layer over Play layer and drag
it downward so that it appears below Play.
31. Select frame at 'Hit'
stage and choose Insert > Keyframe
32. Draw a circle of same size of play button
graphic as a 'hit area' of the button
33. Select frame at 'Hit'
stage on Play layer and choose Insert
> Blank Keyframe
34. Come back into
game movie clip.
35. Select play button and choose Window
> Actions
36. In the Actions panel type the following action
| on
(release) { |
| |
gotoAndStop(1); |
| } |
37.
Select frame 5 on Actions
layer and choose Insert > Keyframe
38. Select keyframe 5 and choose Window
> Actions
39. In the Actions panel
type the following actions
| Mouse.show(); |
| _root.prevscore
= _root.score; |
| if
(_root.prevscore>_root.highscore)
{ |
| |
_root.highscore
= _root.prevscore; |
| } |
| stop(); |
// _root.prevscore
= _root.score;
This action assigns
the value of 'score' variable into 'prevscore'
| //
if (_root.prevscore>_root.highscore)
{ |
| |
_root.highscore
= _root.prevscore; |
| } |
This action checks
whether value assigned to 'prevscore' is greater than 'highscore'.
And if it is true, then the new value of 'prevscore' is assigned
to 'highscore'.
|