web design template web design template web design template

Page : 1 2 3 4

1. Insert a new layer above Scores layer and name it as 'Balloons'

2. Select frame 2 on the Balloons layer and choose Insert > Keyframe

3. Create a balloon graphic of 28px. X 42px.

4. Select the balloon on the stage, convert it into a Movie Clip with center registration point selected and name it as 'balloon'


5. Double click the balloon movie clip to go inside it

6. Select frame 3 and choose Insert > Blank Keyframe

7. At frame 3 create small gradient patches which looks like a bust balloon



8. Select frame 4 and choose Insert > Blank Keyframe

9. Insert a new layer and name it as 'Actions'

10. Select frame 1 on Actions layer and type the following action.

stop();

11. Select frame 4 and choose Insert > Keyframe

12. Select the keyframe 4 and in the Actions panel type the following action

_parent.gotoAndPlay(3);

13. Insert a new layer below the Actions layer and name it as 'Dummy Button'

14. At frame 1 draw a oval shape which can cover the balloon under it



15. Select the oval shape and convert it into a Button with center registration point selected and name it as 'hit button'

16. Double click the hit button to go inside it

17. Select the shape on the frame 1 at Up stage and drag it on the frame 4 i.e. on Hit stage

18. Come back into balloon movie clip

19. Select the hit button and choose Window > Actions

20. In the Actions panel type the following actions

on (press) {
  gotoAndPlay(2);
  _root.score++;
}
// _root.score++;
// Everytime this button gets hit, the value of the variable 'score' increases by 1

21. Select frame 2 on Dummy Button layer

22. Choose Insert > Blank Keyframe

23. Come back into Scene 1

24. Select balloon movie clip on the stage, convert it into another Movie Clip and rename it as 'balloon move'

25. In the Properties panel type the Instance Name as 'balloon'


26. Double click the balloon move movie clip to go inside it

27. Select frame 2 and choose Insert > Keyframe

28. Select balloon movie clip at frame 1 and delete it

29. Insert a new layer over the existing layer and name it as 'Actions'

30. Select frame 1 and in the Actions panel type the following action

stop();

31. Select frame 2 and choose Insert > Keyframe

32. Select frame 2 and in the Actions panel type the following action

stop();

33. Select frame 3 and choose Insert > Keyframe

34. Select frame 3 and in the Actions panel type the following action

removeMovieClip("");


35. Select the balloon movie clip at frame 2 and choose Window > Actions

36. In the Actions panel type the following actions

onClipEvent (load) {
  _root.hitz = 0;
  this._alpha = 0;
}
onClipEvent (enterFrame) {
  this._y -= _root.speedz;
  this._rotation += 7;
  if (this._y<=-80) {
    this._alpha = 100;
  }
  if (this._y<=-380 && _root.hitz == 0) {
    gotoAndPlay(2);
    _root.missed += 1;
    _root.hitz = 1;
  }  
  if (_root._currentframe == 3) {
    _parent.nextFrame();
  }  
}    


// _root.hitz = 0;
// this._alpha = 0;
When movie clip loads, the value of the variable 'hitz' is set to '0' as well as the initial alpha value of the movie clip is set to '0'

// this._y -= _root.speedz;
The Y position of the movie clip goes on decreasing as per the value of variable 'speedz' (Movie clip moves upwards)

// this._rotation += 7;
This action help the movie clip to keep on rotating at the speed of 7

// if (this._y<=-80) {
  this._alpha = 100;
  }
This action checks whether the Y position of the movie clip is less than or equal to 80. If the condition satisfies then the alpha value of the movie clip is set to 100

// if (this._y<=-380 && _root.hitz == 0) {
    gotoAndPlay(2);
    _root.missed += 1;
    _root.hitz = 1;
  }  
This action checks whether the Y position of the movie clip is less than or equal to -380 and at the same time the value of variable 'hitz' is 0. If the condition satisfies then movie clip starts playing from frame 2 and the value of the variable 'missed' increments by 1. The value of variable 'hitz' is set to 1

// if (_root._currentframe == 3) {
    _parent.nextFrame();
  }  
}    
This action checks whether the currentframe position in the root (i.e. level0) is at frame 3. If the condition satisfies then actionscript will go into the parent movie clip (balloon move movie clip) of the current movie clip and play the actions on the next frame.

37. Now come back into Scene 1

38. The balloon move movie clip looks like a dot on the stage


39. Select the balloon move movie clip and drag it downwards so that it appears below the stage area

40. On frame 2 of Balloons layer create a small circle beside the balloon move movie clip

41. Select that small circle and convert it into a Movie Clip and name it as 'trigger'



42. Select the trigger movie clip and choose Window > Actions

43. In the Actions panel type the following actions

onClipEvent (enterFrame) {
  if (_root.z%_root.intervalz == 0) {
    duplicateMovieClip("_root.balloon", "balloons"+_root.z, _root.z);
    setProperty("_root.balloons"+_root.z, _x, random(200)+50);
    tellTarget ("_root.balloons"+_root.z) {
      gotoAndPlay(2);
    }  
  }    
  _root.z++;
}  


// if (_root.z%_root.intervalz == 0)
This action checks whether the value of variable 'z' is perfectly divisible by the value of variable 'intervalz'

// duplicateMovieClip("_root.balloon", "balloons"+_root.z, _root.z);
If the first 'if' condition satisfies then this action will create a duplicate movie clip of the balloon movie clip

// setProperty("_root.balloons"+_root.z, _x, random(200)+50);
This action determines the X position of the duplicated movie clip

// tellTarget ("_root.balloons"+_root.z) {
    gotoAndPlay(2);
  }  
This action lets the duplicated movie clip to play its second frame

// _root.z++;
This action keeps on incrementing the value of variable 'z' by 1

44. Insert a new layer above Balloons layer and rename it as 'Variables'

45. Select frame 2 on Variables layer and choose Insert > Keyframe

46. Select keyframe 2 and in the Actions panel type the following variables (Initialize the variables)

z=0;
// 'z' variable is used for Balloon movie clip
n=0;
// 'n' variable is used for Bonus Balloon movie clip
speedz=7;
speedn=10;
intervalz=20;
intervaln=50;
hitz=0;
hitn=0;
score=0;
missed=0;
time=60;
// time=60 is initialized for one minute timer


47. Choose Control > Test Movie

Now you can see pink balloons flying and at certain point getting busted. If you try to click them with the mouse they will bust and it will increase your score by 1 everytime you hit the balloon. If you miss any of them it will count as a missed balloon.

To add some more interaction to the game we are going to add one more different colored balloon which will give you 5 bonus points if you hit it.

1. Choose Window > Library > balloon movie clip

2. In the Library window click the Options tab to open the menu and choose Duplicate...





© Image Online  2001-2003