|
3. In the Duplicate
Symbol type 'bonus balloon' and create a
copy of balloon movie clip
4. Similarly duplicate
the balloon move movie clip and name it as 'bonus
balloon move movie clip'
5. In the Library, double
click the bonus balloon movie clip to go inside
it
6. At Layer 1 in place
of existing balloon create a different color balloon
with dimensions slightly bigger than the first one. Here we
have taken 33px.X50px.
7. Select the hit button at Dummy Button layer
and make it little bigger to match the size of the new balloon.
8.
Select the hit button and choose Window
> Actions
9. In the Actions panel
make only one line change. In place of '_root.score++'
type '_root.score+=5'
10. Select frame
3 at Layer 1 and change
the color of the bust balloon
11. In the Library,
double click the bonus balloon move movie clip
to go inside it
12. Select the balloon movie clip at frame 2
13. In the Properties panel
with the help of Swap Symbol button,
swap balloon movie clip with bonus balloon movie
clip
14. Select bonus
balloon movie clip and choose Window
> Actions
15. In the Actions panel
delete the existing actions and type the following
actions
| onClipEvent
(load) { |
| |
_root.hitn
= 0; |
| |
this._alpha
= 0; |
| } |
|
| onClipEvent
(enterFrame) { |
| |
this._y
-= _root.speedn; |
| |
this._rotation
-= 5; |
| |
if
(this._y<=-90)
{ |
| |
|
this._alpha
= 100; |
| |
} |
|
| |
if
(this._y<=-380
&& _root.hitn == 0)
{ |
| |
|
gotoAndPlay(2); |
| |
|
_root.missed
+= 1; |
| |
|
_root.hitn
= 1; |
| |
} |
|
| |
if
(_root._currentframe
== 3) { |
| |
|
_parent.nextFrame(); |
| |
} |
|
| } |
|
|
// These actions
are same as we have used for balloons movie clip. Only the variables
are different.
16.
Come back into Scene 1
17. Insert a new layer above balloons layer
and name it as 'Bonus Balloons'
18. Select frame 2 and choose Insert
> Keyframe
19. Choose Window > Library >
bonus balloon move movie clip
20. Drag the bonus balloon move movie clip on
the stage and place it below the stage bottom where we have
placed the balloon move movie clip
21.
In the Properties panel
type the Instance Name
as 'bonballoon'
22. Choose Window
> Library > trigger movie clip
23. Drag the trigger movie clip on the stage
and place it beside the bonus balloon move movie clip
24. Choose Window > Actions
25. In the Actions panel
type the following actions
| onClipEvent
(enterFrame) { |
| |
if
(_root.n%_root.intervaln
== 0) { |
| |
|
duplicateMovieClip("_root.bonballoon",
"bonballoons"+_root.n,
_root.n); |
| |
|
setProperty("_root.bonballoons"+_root.n,
_x, random(200)+50); |
| |
|
tellTarget
("_root.bonballoons"+_root.n)
{ |
| |
|
|
gotoAndPlay(2); |
| |
|
} |
|
| |
} |
|
|
| |
_root.n++; |
| } |
|
// These actions
are same as we have used for balloons movie clip. Only the variables
are different.
26. Choose Control
> Test Movie
Now you can see
pink balloons flying and as well as orange (bonus) balloons
flying after some interval. The orange balloons are bonus
balloons so if you hit them you get 5 bonus points for each
orange balloon.
If you go on playing
the game this game won't get over. So we need to put a timer.
After certain time gets over, the game will stop.
1.
Choose Insert > New Symbol
2. In Create New Symbol
box type 'clock' and create a Movie
Clip
3. In the center of the stage, create a small circle
of 27px.X 27px. with white color fill and green outline
4. Insert a new layer and name it as 'Timer'
5. Create a Dynamic text
field which can contain two digits and place it in the center
of the circle
6. In the Properties panel
type the variable name
as '_root.time'
7. Insert a new
layer above timer layer and rename it as 'Clock
Tic'
8. Create a small clock hand, convert it into
a Graphic with bottom
center registration point selected and name it
as 'clock hand'
9. Place the clock
hand graphic in such way that the registraion point
of clock hand should match with the movie clips
center point.
10.
Select frame 24 on Clock Tic layer and choose
Insert > Keyframe
11. Select any frame between 1 to 24 and choose Insert
> Create Motion Tween
12. In the Properties panel
set Rotation options as
CW
13. Select frame
24 on other two layers and choose Insert
> Frame
14. Insert a new layer above Clock Tic layer
and name it as 'Actions'
15. Select frame 24 and choose Insert
> Keyframe
16. At keyframe 24 assign the following action
_root.time--;
// Everytime when actionscript reaches
at frame 24 the value of variable 'time' decrements by 1.
So it looks like seconds countdown.
17. Go back into
Scene 1
18. Insert a new layer above Bonus Balloons layer
and name it as 'Clock'
19. Select frame 2 at Clock layer and choose
Insert > Keyframe
20. Choose Window > Library >
clock movie clip
21. Drag the clock movie clip on the stage and
place it on the score panel
22. Select the
clock movie clip and choose Window
> Actions
23. In the Actions panel
type the following actions
| onClipEvent
(enterFrame) { |
| |
if
(_root.time == 30)
{ |
| |
|
_root.speedz
= 9; |
| |
|
_root.intervaln
= 30; |
| |
} |
|
| |
if
(_root.time == 10) { |
| |
|
_root.intervalz
= 10; |
| |
} |
|
| |
if
(_root.time == 0) { |
| |
|
_root.gotoAndStop(3); |
| |
} |
|
| } |
|
|
| //
|
if
(_root.time == 30)
{ |
| |
|
_root.speedz
= 9; |
| |
|
_root.intervaln
= 30; |
| |
} |
|
This condition checks
whether the value of variable 'time' is perfectly equal to 30.
If the condition satisfies then the value of variable 'speedz'
is set to 9 to increase the speed of the balloons and the value
of variable 'intervaln' is set to 30 to reduce the time span
between two bonus balloons appearances.
| |
if
(_root.time == 10) { |
| |
|
_root.intervalz
= 10; |
| |
} |
|
This condition checks
whether the value of variable 'time' is perfectly equal to 10.
If the condition satisfies then the value of variable 'intervalz'
is set to 10 to reduce the time span between two balloons appearances.
| |
if
(_root.time == 0) { |
| |
|
_root.gotoAndStop(3); |
| |
} |
|
This condition checks
whether the value of variable 'time' is perfectly equal to 10.
If the condition satisfies then actionscript will go and stop
at frame 3 in Scene 1.
|