Ce code est fourni sous une licence CC-By (cf. fin de page).
De plus, il est interdit de recompiler le jeu directement en supprimant simplement le lien «Plus de jeux», la mention «directement» restant à l'appréciation de l'auteur original du code source.
Le code est réparti en classes claires et nettes. L'ensemble du fichier représente moins de 10ko !
Ces fichiers définissent l'architecture de base : la boite qui affiche un apercu des niveaux, la boite de dialogue, les données des niveaux...
Code source : ChargementNiveaux.as
Langage : actionscript3 Taille : 8563 caract�res /////////////////////////////////////
//Fonctions de création de niveau
/////////////////////////////////////
function GetLevelData(Numero:int,Mute:Boolean=false):Game
{
var Jeu:Game;
//Renvoie les données pour un niveau fixé.
var Message:String="";
//Prototype : new Game(FirstPlayer,Short_Type,Cut_Type,Datas,Passif=false)
if(Numero==0)
{
Jeu=new Game(Const.SHORT,Const.COMPUTER,Const.HUMAN,"50,240|320,100|320,380|590,240:0,1,0,0|0,2,0,480|2,3,640,0|1,3,640,480",Mute);
Message="<u>Règles de C-graphe : <font size=\"-2\"><i>(partie 1/2)</i></font></u><br>Bienvenue ! Votre nom est <b>Couhpeur</b>.<br />Votre mission est d'empêcher l'ordinateur de dessiner un chemin complet entre les deux points rouges. Pour cela, pendant votre tour, cliquer sur un trait afin de le supprimer. On se revoit tout de suite après...(l'ordinateur a déjà joué un coup, en blanc)";
}
if(Numero==1)
{
Jeu=new Game(Const.SHORT,Const.HUMAN,Const.COMPUTER,"50,50|320,240|590,430:0,1,0,240|0,1,320,0|1,2,320,480|1,2,640,240",Mute);
Message="<u>Règles de C-graphe : <font size=\"-2\"><i>(partie 2/2)</i></font></u><br>Pas mal ! Votre nom est dorénavant <b>Paintre</b>.<br />Votre mission est de dessiner un chemin complet entre les deux points rouges. Pour cela, pendant votre tour, cliquez sur un trait afin de le peindre. L'ordinateur essaiera de vous en empêcher...";
}
if(Numero==2)
{
Jeu=new Game(Const.SHORT,Const.HUMAN,Const.COMPUTER,"100,240|280,100|280,380|460,50|460,430|620,240:5,3,350,200|3,1,260,170|5,4,350,280|4,2,260,310|2,0,145,300|0,1,145,180|1,2,185,240|5,2,180,250|5,1,180,250",Mute);
Message="Pour cette partie, vous serez <b>Paintre</b>.<br />N'oubliez pas:<li>Vous pouvez peindre n'importe quel trait tant qu'il n'est pas coupé</li><li><b>Coupheur</b> fera tout pour vous empêcher de rejoindre les points rouges</li><li>Le terrain est traître, pensez à l'examiner !</li>Bonne chance, et peut être à plus tard.";
}
if(Numero==3)
{
Jeu=new Game(Const.SHORT,Const.HUMAN,Const.COMPUTER,"34,249|72,159|80,379|129,336|109,378|130,418|156,126|153,172|204,76|283,76|369,75|522,66|361,128|199,338|312,418|319,340|464,131|433,345|386,387|483,414|563,216:5,2,105,399|2,3,104,358|3,4,124,355|4,2,99,377|2,0,57,314|0,1,53,204|7,1,113,166|1,6,114,142|6,8,180,101|8,9,244,76|9,10,326,75|10,11,446,70|12,6,259,127|13,7,174,215|3,13,162,297|5,13,162,338|5,3,129,377|15,13,257,299|5,14,221,418|14,15,315,379|16,12,413,129|7,15,236,256|15,12,340,234|19,14,397,416|14,18,349,403|18,17,410,366|17,15,376,343|17,16,448,238|17,19,458,379|12,10,365,101|20,11,542,141|16,20,513,174|20,17,498,281|19,20,523,315",Mute,Const.AI_NOT_SMART);
}
if(Numero==4)
{
Jeu=new Game(Const.SHORT,Const.COMPUTER,Const.HUMAN,"11,13|156,11|7,112|6,188|119,121|252,15|127,224|262,103|314,212|209,330|411,150|17,327|386,11|391,296|455,340|554,293|511,367|471,413|600,398:0,2,9,63|0,1,84,12|1,2,82,62|5,1,204,13|2,3,7,150|4,2,63,117|4,1,138,66|7,5,257,59|7,4,191,112|4,6,123,173|6,3,67,206|8,7,288,158|8,6,221,218|10,7,337,127|8,10,363,181|8,9,262,271|9,6,168,277|11,6,72,276|11,9,113,329|12,7,324,57|12,10,399,81|13,10,401,223|13,8,353,254|13,9,300,313|14,13,423,318|17,14,463,377|14,16,483,354|14,15,505,317|18,15,631,309|16,18,556,383|17,18,531,472|18,15,577,346|18,17,536,406",Mute,Const.AI_SMART);
}
if(Numero==5)
{
Jeu=new Game(Const.SHORT,Const.HUMAN,Const.COMPUTER,"27,44|311,48|23,109|159,165|312,171|312,232|161,232|23,182|435,204|242,259|241,224|239,361|238,412|178,361|178,417|113,358|111,421|64,352|63,428|14,337|15,443|542,226:0,1,169,46|0,2,25,76|2,3,75,132|2,4,168,140|4,6,236,202|3,5,235,199|3,6,160,199|4,5,312,202|5,8,385,272|6,7,90,268|7,9,166,198|8,9,296,196|8,9,428,288|7,9,8,285|9,10,241,243|9,11,240,310|11,12,238,386|12,14,208,414|14,13,178,389|13,11,208,361|13,15,145,360|15,17,85,357|17,19,34,350|19,20,7,388|20,18,33,428|18,16,86,423|16,14,144,419|16,15,112,389|18,17,56,391|11,14,208,389|12,13,208,386|13,16,144,391|15,14,145,387|21,1,423,138|21,12,386,319|9,13,210,310|9,15,177,308|9,17,153,305|9,19,128,298|21,14,259,475|10,3,200,194|10,4,276,197",Mute);
}
if(Numero==6)
{
Jeu=new Game(Const.SHORT,Const.HUMAN,Const.COMPUTER,"50,230|141,230|211,230|305,230|420,230|485,180|485,280|90,155|90,305|185,155|185,305|305,155|305,90|305,305|305,370|550,230:0,1,96,230|1,7,116,192|1,8,115,261|8,10,140,293|10,2,201,260|1,2,172,181|1,2,176,227|7,9,136,153|9,11,253,106|10,13,251,294|13,14,310,320|14,4,365,285|11,12,312,116|12,4,366,158|11,4,367,184|13,4,366,261|11,3,315,184|3,4,369,227|4,5,453,208|4,6,453,244|6,15,522,243|5,15,522,207|5,6,486,225|10,7,-100,480|10,9,-75,0|9,3,250,189|0,8,70,262|14,12,850,224|9,11,247,145",Mute,Const.AI_SMART);
}
if(Numero==7)
{
Jeu=new Game(Const.SHORT,Const.COMPUTER,Const.HUMAN,"51,225|343,217|428,218|495,216|295,191|296,250|294,143|293,302|189,139|187,90|190,305|187,349|49,305|48,134|490,151|546,181|590,139|530,98|417,151:0,13,50,180|0,12,50,265|12,10,120,305|12,11,118,327|11,7,240,326|7,10,242,304|13,8,119,137|13,9,118,112|9,6,241,117|6,8,242,141|0,8,120,182|0,6,173,184|0,10,121,265|0,7,172,264|7,5,295,276|6,4,295,167|4,1,319,204|1,5,320,234|4,5,296,221|11,1,353,374|9,1,349,70|1,2,386,218|2,3,462,217|3,14,493,184|14,15,518,166|15,16,568,160|16,17,560,119|17,14,506,128|15,17,538,140|14,16,540,145|18,14,455,120|18,14,445,171|18,17,435,87|2,14,459,185|2,17,316,32|3,16,601,245|0,4,173,208|0,5,174,238",Mute,Const.AI_SMART);
}
if(Numero==8)
{
Jeu=new Game(Const.SHORT,Const.HUMAN,Const.COMPUTER,"5,250|60,200|60,300|110,250|110,150|180,50|180,200|180,300|250,200|300,200|300,250|350,200|400,250|450,200|465,50|500,150|520,250|565,150:0,1,31,217|0,2,31,265|2,3,49,234|3,2,84,264|1,3,83,216|1,4,85,156|4,5,148,85|5,6,184,114|6,7,186,233|7,3,147,263|3,6,148,210|6,4,150,150|4,3,112,181|5,8,208,114|6,8,210,179|7,8,209,233|9,8,264,110|8,9,273,242|11,5,354,84|9,10,308,209|10,11,334,227|11,9,333,194|3,10,180,415|12,10,352,253|12,13,426,236|10,13,401,350|12,14,427,163|13,15,471,178|16,13,489,221|16,15,502,191|14,16,524,128|17,14,513,107|17,16,542,192",Mute,Const.AI_NOT_SMART);
}
if(Numero==9)
{
Jeu=new Game(Const.SHORT,Const.HUMAN,Const.COMPUTER,"290,100|290,161|401,206|193,210|118,78|107,282|189,257|178,323|279,289|273,363|332,317|364,247:0,1,290,131|1,3,242,186|3,0,242,155|0,2,346,153|2,1,346,184|2,4,520,72|5,4,113,180|3,5,150,246|5,6,148,270|5,7,143,303|6,9,231,310|7,8,229,306|8,10,306,303|9,10,303,340|9,8,276,326|8,11,322,268|11,10,348,282|6,7,184,290|5,0,144,141|4,3,156,144|6,3,191,234",Mute,Const.AI_SMART);
}
if(Numero==10)
{
Jeu=new Game(Const.SHORT,Const.COMPUTER,Const.HUMAN,"29,96|164,31|111,147|239,86|262,195|613,353|391,100|514,59|344,205|48,422:0,1,66,70|0,3,134,91|0,2,70,121|2,3,175,116|4,2,186,171|3,4,250,140|5,4,282,321|6,1,389,66|3,6,360,176|8,6,493,163|8,7,477,218|5,8,366,284|7,5,437,291|7,6,386,71|1,7,552,21|9,4,155,308|9,5,331,387",Mute,Const.AI_NOT_SMART);
}
if(Numero==11)
{
Jeu=new Game(Const.SHORT,Const.HUMAN,Const.COMPUTER,"17,237|94,156|97,238|117,303|168,242|166,117|100,86|42,52|106,20|170,44|323,52|243,143|328,133|382,131|445,72|398,90|433,108|470,198|504,120|179,345|230,309|279,370|260,390|314,302|271,330|510,362|325,427|433,132|396,182|380,353|476,447|398,412|554,458:0,1,56,197|1,2,96,197|2,3,95,286|3,0,69,272|4,1,136,196|0,2,57,238|2,4,138,237|4,5,172,176|5,1,130,137|8,6,103,53|6,1,97,121|5,6,133,102|6,7,71,69|7,8,74,36|8,9,138,32|9,5,168,81|12,11,287,130|11,5,206,122|9,10,247,48|10,12,326,93|11,4,211,189|13,10,353,92|12,13,355,132|14,10,384,62|13,15,390,111|15,16,416,99|16,14,439,90|14,15,422,81|13,16,408,120|18,17,487,159|18,14,475,96|14,17,458,135|3,19,153,325|19,22,228,372|4,20,199,276|20,21,255,340|20,23,272,306|23,21,297,336|24,23,293,316|24,21,275,350|21,22,270,380|25,17,490,280|26,22,288,403|21,26,298,393|4,27,252,224|27,25,423,284|28,4,331,214|28,25,396,249|23,28,355,242|26,29,353,390|23,29,347,328|31,29,389,383|26,31,362,420|31,30,437,430|30,25,493,405|32,30,540,403|30,32,515,453",Mute);
}
//
Jeu.NumeroNiveau=Numero;
if(Message!="" && !Mute)
ShowMessage(Message);
return Jeu;
}
function ChargementNiveauDirect(e:Event):void
{//Triggeré quand clic sur une des miniatures dans Boite.
while(Boite.numChildren > 0)
Boite.removeChildAt(0);//libérer de la mémoire (même si on ne peut s'assurer du passage du garbage collector)
Boite.addChild(ChangeLevelInfo);
ChangeLevelInfo.htmlText="<u>Chargement en cours</u> (niv. <b>"+e.currentTarget.Layer.NumeroNiveau+"</b>)";
NumeroNiveauActuel=e.currentTarget.Layer.NumeroNiveau;
LancerNouveauNiveau(e.currentTarget.Layer.NumeroNiveau);
} Permet de jouer à plusieurs sur un terrain personnalisé.
Un jeu est une instance de Game. Cette instance se décompose en un BackGround (le fond qui bouge), et un terrain (Land) qui contient les noeuds et les aretes.
Le Game contient aussi les références vers les deux joueurs, (Human ou AI, tous deux héritant de Player).