My methode :
ffc script Carre{ void run(int enemyID){ npc ghost = Ghost_InitAutoGhost(this, enemyID); Ghost_SetFlag(GHF_NORMAL); Ghost_SetFlag(GHF_MOVE_OFFSCREEN); Ghost_SetFlag(GHF_NO_FALL); int sens = Vertical; int origtile = ghost->OriginalTile; int delay = Delayboutton; int offset = 0; int cache = 0; int step = 1; bool gauche = false; bool droite = false; int HautY=Ghost_Y; while(true){ if(delay>0)delay--; if(!Link->InputA)pressA=false; if(!Link->InputLeft)gauche=false; if(!Link->InputRight)droite=false; if(Ghost_Y < -16){ if(Ghost_X==80){gauche=false;droite=true;} else if(Ghost_X==96){gauche=true;droite=false;} else if(Ghost_X==112){gauche=true;droite=false;} } else if(Ghost_Y >= -16 && Ghost_Y < 0){ if(Ghost_X==64){gauche=false;droite=true;} else if(Ghost_X==80){gauche=true;droite=true;} else if(Ghost_X==96){gauche=true;droite=true;} else if(Ghost_X==112){gauche=true;droite=false;} else if(Ghost_X==128){gauche=true;droite=false;} } else if(Ghost_Y >= 0 && Ghost_Y < 16){ if(Ghost_X==16){gauche=false;droite=true;} else if(Ghost_X>16 && Ghost_X<160){gauche=true;droite=true;} else if(Ghost_X==160){gauche=true;droite=false;} } else if(Ghost_Y>=16){ droite=true; gauche=true; } if(Link->InputLeft && Screen->isSolid(Ghost_X-1, Ghost_Y) == false && Screen->isSolid(Ghost_X-1, Ghost_Y+16) == false && gauche==true && delay==0){ Ghost_X-=16; Game->PlaySound(SonBlocMove); delay=Delayboutton; } else if(Link->InputRight && Screen->isSolid(Ghost_X+32, Ghost_Y) == false && Screen->isSolid(Ghost_X+32, Ghost_Y+16) == false && droite==true&& delay==0){ Ghost_X+=16; Game->PlaySound(SonBlocMove); delay=Delayboutton; } if(Ghost_Y<160)HautY=Ghost_Y; if(Screen->isSolid(Ghost_X, Ghost_Y+32) == true || Screen->isSolid(Ghost_X+16, Ghost_Y+32) == true){ if(HautY<0)defaite=true; if(cache==0){ if(Link->InputDown)Game->Counter[CR_Score]+=2; else Game->Counter[CR_Score]+=1; cache=1; } Game->PlaySound(BlocPose); Screen->ComboD[ComboAt(Ghost_X, Ghost_Y)] = ComboCarre; Screen->ComboD[ComboAt(Ghost_X+16, Ghost_Y)] = ComboCarre; Screen->ComboD[ComboAt(Ghost_X, Ghost_Y+16)] = ComboCarre; Screen->ComboD[ComboAt(Ghost_X+16, Ghost_Y+16)] = ComboCarre; Ghost_UnsetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_UnsetFlag(GHF_NO_FALL); if(Ghost_Y<160)Ghost_Y=160; if(Ghost_Y<=160)Ghost_Y++; } if(Link->InputDown)step=6; else step=1; if(Screen->D[0]<1)Ghost_Move(DIR_DOWN, (0.25+Vitesse)*step, 0); if(cache==0)Screen->DrawTile(layer, Ghost_X, Ghost_Y, 8740, 2, 2, 2, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); Ghost_Waitframe(this, ghost); } } }