Home Projects Flash CS3 How to Create a Tile Game Like Destruct-O-Match on Neopets.com - End Of Level / Game Functions





Forgot your password?
Forgot your username?
No Account Yet? Create an account

Like it? Share it!

Add to: JBookmarks Add to: Facebook Add to: Windows Live Add to: Ximmy Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: Jumptags Add to: Upchuckr Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Yahoo Add to: Blogmarks Add to: Diigo Add to: Technorati Information

How to Create a Tile Game Like Destruct-O-Match on Neopets.com
How to Create a Tile Game Like Destruct-O-Match on Neopets.com - End Of Level / Game Functions PDF Print E-mail
User Rating: / 2
PoorBest 
Projects - Flash CS3
Written by drooza   
Tuesday, 23 September 2008 19:02
Article Index
How to Create a Tile Game Like Destruct-O-Match on Neopets.com
Linking the Tile class
Creating the Tile Game Engine
Initializing Level Functions
In Game Functions
Clumping Functions
End Of Level / Game Functions
Creating the .fla
Let's Play the Game!
All Pages

End Of Level / Game Functions

 

/**  If the user has cleared all the blocks they get a huge bonus!
*
**/
private function calculateBonus(tilesLeft:int):Number
{
switch(tilesLeft)
{
case 0: return 500;
case 1: return 250;
case 2: return 200;
case 3: return 150;
case 4: return 100;
case 5: return 50;
}
return 0;
}

private function nextLevelPopUp():void
{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
nextLevel_mc = new NextLevelButton;
nextLevel_mc.x = 290 - nextLevel_mc.width;
nextLevel_mc.y = 50;
addChild(nextLevel_mc);
nextLevel_mc.addEventListener(MouseEvent.CLICK, startNextLevel);
}

private function showEndPopUp():void
{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
playAgain_mc = new PlayAgainButton();
playAgain_mc.x = 290 - playAgain_mc.width;
playAgain_mc.y = 50;
addChild(playAgain_mc);
playAgain_mc.addEventListener(MouseEvent.CLICK, restartGame);
}

private function restartGame(e:Event):void
{
resetGameVariables();
destroyAll();
fillArray(types);
showTiles();
gameState = CONTINUE;
removeChild(playAgain_mc);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}


Comments
Add New Search
Bug Found
drooza (SAdministrator) 2008-09-23 19:59:00

There's this one bug that happens sparingly. Sometimes the tiles don't
fall into correct place and are stuck, suspended in the air. If I remove the
animation totally, then no more bug. I've got that much.

I'm thinking I have
to check where the tile is located when the animation stops.
Bug Fix:
drooza (SAdministrator) 2008-11-07 09:54:10

Because a tween object is instantiated inside an if statement (oops) the
garbage collector is taking care of business and removing the
tween before it completes.

By making this tween a part of the Tile
class, this may fix the problem.

Other fixes in the comments section
of this page: http://livedocs.adobe.com/flash/9.0/ActionScrip...
Losing?
KeenEyes (76.174.154.xxx) 2008-10-09 18:52:29

How do you lose in this game again? lol
drooza (SAdministrator) 2008-10-09 19:11:10

If you don't achieve the points set by the game for that level, you lose.
donald (119.154.16.xxx) 2010-02-15 23:47:27

thanks for your toturial....its really nice and mean full. I want to write
more but these days I am doing preparation of different
online certifications and I found ccna certification is the best helping source which is providing 100% authentic material. I
also spend my extra time in surfing internet, listening music
and playing games. After my exams I would like to join your group.
Write comment
Name:
Email:
 
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
:angry::0:confused::cheer:B)
:evil::silly::dry::lol::kiss:
:D:pinch::(:shock::X
:side::):P:unsure::woohoo:
:huh::whistle:;):s:!:
:?::idea::arrow:
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Saturday, 22 November 2008 13:05 )
 

Make a Donation!

Advertisement
Banner

HomeProjectsSnippetsContact Me

Copyright © 2008, Drooza.com