Hice un juego para arrastrar y soltar carteles (clips) a sus respectivos lugares vacios (otros clips). Hay un boton llamado Enviar para corregir el juego. Si se presiona Enviar y faltan ubicar carteles, debe salir un mensaje para que ubique los carteles que faltan, el mensaje se llama Falta.
Si los carteles estan bien ubicados sale un mensaje (Bien) y si estan mal sale otro (Mal).
Los carteles se llaman c1, c2, c3 y c4. Los clips vacios se llaman cuadro1, cuadro2, cuadro3 y cuadro4.
El problema es que si presiono enviar y faltan clips para ubicar, me sale el mensaje para que ubique el resto de los carteles, pero tambien me sale la correccion de que esta Mal. Y el mensaje de correccion Mal debe salir unicamente si todos los carteles fueron ubicados.
Este es el codigo para el dragueo:
Código :
on (press) {
startDrag(this,false)
this.swapDepths(_parent.getNextHighestDepth());
_parent.falta._visible=0;
}
on (release, releaseOutside) {
stopDrag();
if (this.hitTest (_parent.cuadro1)) {
this._x = _parent.cuadro1._x;
this._y = _parent.cuadro1._y;
}
if (this.hitTest (_parent.cuadro2)) {
this._x = _parent.cuadro2._x;
this._y = _parent.cuadro2._y;
}
if (this.hitTest (_parent.cuadro3)) {
this._x = _parent.cuadro3._x;
this._y = _parent.cuadro3._y;
}
if (this.hitTest (_parent.cuadro4)) {
this._x = _parent.cuadro4._x;
this._y = _parent.cuadro4._y;
}
}
Y este es el codigo para la correccion:
Código :
bien._visible=0;
mal._visible=0;
falta._visible=0;
enviar.onRelease=function() {
if (cuadro1.hitTest(c1)==0 or cuadro1.hitTest(c2)==0 or cuadro1.hitTest(c3)==0 or cuadro1.hitTest(c4)==0 or cuadro1.hitTest(c5)==0 or cuadro1.hitTest(c6)==0){
bien._visible=0;
mal._visible=0;
falta._visible=1;
}
if (cuadro2.hitTest(c1)==0 or cuadro2.hitTest(c2)==0 or cuadro2.hitTest(c3)==0 or cuadro2.hitTest(c4)==0 or cuadro2.hitTest(c5)==0 or cuadro2.hitTest(c6)==0){
bien._visible=0;
mal._visible=0;
falta._visible=1;
}
if (cuadro3.hitTest(c1)==0 or cuadro3.hitTest(c2)==0 or cuadro3.hitTest(c3)==0 or cuadro3.hitTest(c4)==0 or cuadro3.hitTest(c5)==0 or cuadro3.hitTest(c6)==0){
bien._visible=0;
mal._visible=0;
falta._visible=1;
}
if (cuadro4.hitTest(c1)==0 or cuadro4.hitTest(c2)==0 or cuadro4.hitTest(c3)==0 or cuadro4.hitTest(c4)==0 or cuadro4.hitTest(c5)==0 or cuadro4.hitTest(c6)==0){
bien._visible=0;
mal._visible=0;
falta._visible=1;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ((cuadro1.hitTest(c1)) and (cuadro2.hitTest(c2) or cuadro2.hitTest(c3)) and (cuadro3.hitTest(c2) or cuadro3.hitTest(c3)) and (cuadro4.hitTest(c4))) {
bien._visible=1;
mal._visible=0;
bien.gotoAndPlay("on");
enviar.enabled=0;
falta._visible=0;
}
if (cuadro1.hitTest(c2) or cuadro1.hitTest(c3) or cuadro1.hitTest(c4) or cuadro2.hitTest(c1) or cuadro2.hitTest(c4) or cuadro3.hitTest(c1) or cuadro3.hitTest(c4) or cuadro4.hitTest(c1) or cuadro4.hitTest(c2) or cuadro4.hitTest(c3)) {
bien._visible=0;
mal._visible=1;
mal.gotoAndPlay("on");
enviar.enabled=0;
falta._visible=0;
}
}
A ver si me pueden ayudar.
Gracias!.
