Flashadvisor logo
:: Desktop Shortcut
:: Flash Help
Advices from Experts

 Submit Here! Link to Us Newsletter Tell a Friend

      Add Tutorial |

 

Advertise here

Create Speaking Characters for your website and Flash movies. 15 Day Free Trial




PHP Scripts

 

 Home > Tutorials  > Gaming

The Winx fight

Author: c.v.nisha angeline | Email


Advertisement

Start Page 1
This game is a two player game where two characters winx(bloom) and witch fight with each other. These characters are taken from a famous cartoon namely winx club.
1. open a new file in flash
2. now create a new layer and name it title page
3. in this title page create a frame and put in the name of the game and the author of the game and other stuff you wish too .let it come till frame 6.
4. now create another layer namely control
5. now create another frame 7 and put in three buttons
namely,
a. start button -> to start the game
b. control button-> that shows the game controls
c. exit button
6.now create frame 7 in control layer and in action script put this code

stop();
b1Score = 0;
b2Score = 0;
winningScore = 100000;

Here b1Score shows the score of Winx.
b2Score shows the score of Witch.
winningScore is set to 100000 or less. The character that reaches this score first will be the winner.
6a.now create frame 8 in control layer and in action script put this code

stop();

6.in frame 8 create a start button and in action script put this code

on(release) {
_root.gotoAndStop(9);
}


6.now create frame 8 in title layer and define the controls on keyboard for the two characters
Picture control page

7.now create two other layers for witch and for winx
8. now create the following movie clips

(Movie clips are created by creating the character then right click on it and click convert to movie clip option, then double click on the image now create frames in it as you like for movements ).
a. bmain->it is the movie clip that has sub movie clips namely

a1.bloomstill
a2. bloomleft
a3. bloomright
a4. bloomup
a5. bloomdown
a6. bloomkick
a7. bloomwinx(a special power)
a8. s2(falling down action)
each of these sub movie clips should have frames to represent the particular action (eg. if bloom is flying left create frames to shoe that action as a frame by frame animation)
9. Similarly do for witch too the following movie clip wmain
Within which we have sub movie clips namely
a1.witchstill
a2. witchup
a3. witchdown
a4. witchleft
a5. witchright
a6. witchkick
a7. witchfreeze(special power)
a8. witchfall
10. Now the movie clips bmain is put in the layer bloom in frame 9
11. And the movie clips wmain is put in the layer witch in frame 9
12.click on the movie clip bmain and put this name in the properties window as b1main
13.click on the movie clip wmain and put this name in the properties window as b2main
14. click on the movie clip bmain and put this code in the action script

onClipEvent(keyDown) {
//w key for winx
if (Key.isDown(87)) {
this.gotoAndStop(7);
// check for collision
if(_root.b1main.bllomwinx, hitTest(_root.b2main))
{
// play a sound, (we'll do this later)
//add 2 to score
b1Score += 1;
// check if score is greater than winning score
if(b1Score >= 50)
{
_root.gotoAndStop(10);
}
updateAfterEvent();
}


// k key for kick
} if (Key.isDown(75)) {
this.gotoAndStop(6);
// check for collision
if(_root.b1main.bllomkick, hitTest(_root.b2main))
{
// play a sound, (we'll do this later)
//add 2 to score
b1Score += 2;
_root.b2main.gotoAndStop(8);
// check if score is greater than winning score
if(b1Score >= 50)
{
_root.gotoAndStop(10);
}
updateAfterEvent();
}
// up key for Move up
} if (Key.isDown(key.UP)) {
this.gotoAndStop(4);
this._y=_y-10;
// down key for move down
} if (Key.isDown(KEY.DOWN)) {
this.gotoAndStop(5);
this._y=_y+10;
// left key for move left
}if (Key.isDown(KEY.LEFT)) {
this.gotoAndStop(3);
this._x=_x-10;
}
// right key for move right
if (Key.isDown(KEY.RIGHT)) {
this.gotoAndStop(2);
this._x=_x+10;
}

}


14. click on the movie clip wmain and put this code in the action script

onClipEvent(keyDown) {
//9 key for witch
if (Key.isDown(105)) {
this.gotoAndStop(7);
if(_root.b2main.witchfreeze, hitTest(_root.b1main))
{
// play a sound, (we'll do this later)
//add 2 to score
b2Score += 1;
// check if score is greater than winning score
if(b2Score >= 50)
{
_root.gotoAndStop(11);
}
updateAfterEvent();
}
// 1 key for kick
} if (Key.isDown(97)) {
this.gotoAndStop(6);
// check for collision
if(_root.b2main.witchkick, hitTest(_root.b1main))
{
// play a sound, (we'll do this later)
//add 2 to score
b2Score += 2;
_root.b1main.gotoAndStop(8);

// check if score is greater than winning score
if(b2Score >= 50)
{
_root.gotoAndStop(11);
}
updateAfterEvent();
}
// 8 key for Move up
} if (Key.isDown(104)) {
this.gotoAndStop(2);
this._y=_y-10;
// 5 key for move down
} if (Key.isDown(101)) {
this.gotoAndStop(3);
this._y=_y+10;
// 4 for move left
}if (Key.isDown(100)) {
this.gotoAndStop(4);
this._x=_x-10;

}
// 6 key for move right
if (Key.isDown(102)) {
this.gotoAndStop(5);
this._x=_x+10;
}
}

15. now as a final touch give one winner page in frame10 for bloom and in frame 11 for witch in the title layer in your own style .
16.thats it your first game is over now it is all in your hands to put in your imagination and create a great game on your own ,have fun!


Download Source File

| 1 |

Rate This Tutorial :
We hope the information helped you. If you have any questions or comments, please don't hesitate to post them on the Forums section
Submit your Tutorial at Click Here
  

Home | About Us | Contact Us | Feedback | Advertise with us

Best viewed in 800x600 resolution with Internet Explorer.

Site Developed and Hosted by  ethicsolutions.com
All rights reserved with FlashAdvisor

Flash is a registered trademark of Adobe Systems, Inc.

8 users online