Accueil > Test collisions entre objets Avec Eanim version 7__6b |
version v3 |
09/02/2007 |
Nouvelle version Eanim avec Mtasc integre. Dans l'editeur Mtasc , choisir dans le cadre haut droit "Liste
Fonctions" |
dans le phi, un permanent: //-----si CARRE rouge touche boule------ if(_root.hitest1==true) {// info venant MTASC _root.hitest1=false; // RAZ de l'info Mtasc _root.boing_t._x=_root.boule._x; _root.boing_t._y=_root.boule._y; gotoGroup( _root.boing_t, 2 ); // affiche bulle PlayGroup(_root.boing_t ); } // fin if hitTest1 //-----si CARRE BLEU touche boule------ if(_root.hitest2==true) {// info venant MTASC _root.hitest2=false; // RAZ de l'info Mtasc _root.boing_t._x=_root.boule._x; _root.boing_t._y=_root.boule._y; gotoGroup( _root.boing_t, 2 );// affiche bulle PlayGroup(_root.boing_t ); } // fin if hitTest2 //-----si CARRE JAUNE touche boule------ if(_root.hitest3==true) {// info venant MTASC _root.hitest3=false; // RAZ de l'info Mtasc _root.boing_t._x=_root.boule._x; _root.boing_t._y=_root.boule._y; gotoGroup( _root.boing_t, 2 );// affiche bulle PlayGroup(_root.boing_t ); } // fin if hitTest3 //------- appel de la fonction mtac ------------ _root.cible1=_root.boule;// Objet qui se deplace _root.cible2=_root.carre; // carre rouge _root.cible3=_root.carre1; // carre bleu _root.cible4=_root.carre2; // carre jaune ->test:collision1(); // appel fonction 1 ->test:collision2(); // appel fonction 2 ->test:collision3(); // appel fonction 3 |
|||
|
// --prog script test de collision- V1------ // --prog test de collision- V7_5d ------ class test{ /*==========Fonction collision==========*/ static function collision1() { var mc1:Object = new Object(); mc1 = _root.cible2; /*------ test si collision ---------- */ if (mc1.hitTest(_root.cible1)) { /*test si carre touche 'cible x'*/ _root.hitest_text="Touche_ROUGE"; /*Affiche touche */ _root.hitest1=true; /* retourne etat collision*/ } /* fin if hitTest */ } /*==========FIN Fonction collision======*/ /*==========Fonction collision==========*/ static function collision2() { var mc2:Object = new Object(); mc2 = _root.cible3; /*------ test si collision ---------- */ if (mc2.hitTest(_root.cible1)) { /*test si carre touche 'cible x'*/ _root.hitest_text="Touche_BLEU"; /*Affiche touche */ _root.hitest2=true; /* retourne etat collision*/ } /* fin if hitTest */ } /*==========FIN Fonction collision==========*/ /*==========Fonction collision==========*/ static function collision3() { var mc3:Object = new Object(); mc3 = _root.cible4; /*------ test si collision ---------- */ if (mc3.hitTest(_root.cible1)) { /*test si carre touche 'cible x'*/ _root.hitest_text="Touche_JAUNE"; /*Affiche touche */ _root.hitest3=true; /* retourne etat collision*/ } /* fin if hitTest */ } /*==========FIN Fonction collision==========*/ } // fin de la class |