martialb75
Messages postés5Date d'inscriptionmardi 19 avril 2005StatutMembreDernière intervention 6 mars 2007
-
6 mars 2007 à 13:39
Mansuz
Messages postés169Date d'inscriptionlundi 11 décembre 2006StatutMembreDernière intervention25 janvier 2014
-
6 mars 2007 à 19:35
Bonjour, J'utilise flash plus comme un designer qu'un codeur.
J'ai téléchargé les sources d'un jeux simple mais fun.
Il fonctionne a merveille mais je voudrais que ce jeux soit dans un movie clip (que je nommerai mc_game) qui se trouvera sur la scène principale. Or quand je fais ca et que je change les _root en _root.mc_game, ca ne fonctionne pas.
A vrai dire, je suis perdu.
Voic le lien du jeux pour vous rendre compte : www.martialb.com/blocks.html
Voici le code :
// reset variables and place tiles
function resetTiles() {
x=0; y=0;
while(x<10) {
while(y<10) {
duplicateMovieClip("tiles","t"+ x + "_" + y, ++d);
t=this["t"+ x + "_" + y];
t._x= (x*28);
t._y= (y*28);
c=int(random(4))+1;
t.col=c;
t.state=true;
t.gotoAndStop(c);
t.x=x;
t.y=y;
y++;
}
y=0;
x++;
}
}
// find and remove same color tiles
function findTile(x,y) {
col =_root["t"+ x + "_" + y].col;
if ((_root["t"+ (x-1) + "_" + y].col == col) or (_root["t"+ (x+1) + "_" + y].col == col) or (_root["t"+ x + "_" + (y-1)].col == col) or (_root["t"+ x + "_" + (y+1)].col == col)) {
_root["t"+ x + "_" + y].state=false;
_root["t"+ x + "_" + y].gotoAndStop(5);
tiles--;
sc++;
if ((_root["t"+ (x-1) + "_" + y].col == col) and (_root["t"+ (x-1) + "_" + y].state==true)) {findTile((x-1),y); }
if ((_root["t"+ (x+1) + "_" + y].col == col) and (_root["t"+ (x+1) + "_" + y].state==true)) {findTile((x+1),y); }
if ((_root["t"+ x + "_" + (y-1)].col == col) and (_root["t"+ x + "_" + (y-1)].state==true)) {findTile(x,(y-1)); }
if ((_root["t"+ x + "_" + (y+1)].col == col) and (_root["t"+ x + "_" + (y+1)].state==true)) {findTile(x,(y+1)); }
_root["t"+ x + "_" + y].col=0;
}
}
// check tile and below it
function checkTile() {
x=0; y=0;
while(x<10) {
while(y<9) {
if ((_root["t"+ x + "_" + (y+1)].col ==0) and (_root["t"+ x + "_" + y].col != 0)) {replaceColors(x,y); checkTile();}
y++;
}
y=0;
x++;
}
}