Comunidad de diseño web y desarrollo en internet online

HitTest Exacto Muchos Problemas!!!

Citar            
MensajeEscrito el 19 Abr 2007 11:22 pm
:o Hola :D

He tenido un problemilla....
Estoy haciendo un juego, donde uno dibuja una raya para que las personas no caigan etc...
Bueno, el HitTest Exacto que lei por ai en el foro, resulta....Eficiente..
Pero hay un Grabe Gran problema..Solo me es eficiente si ambas cosas estan en el _root de la pelicula..En tonses..No se como aserlo..pero si lo mc no estan en el root sino ..ejemplo en

Código :

_root.ecenario.suelo

y los personajes

Código :

_root.personajes.personaje1


Idea de como¿?

Hit Exacto me refiero, a que no solo es cuadrado, sino redondo, o triangular...etc..

Por JaLeRu

Claber

1913 de clabLevel

7 tutoriales

Genero:Masculino  

Existo

firefox
Citar            
MensajeEscrito el 19 Abr 2007 11:31 pm
NO se preocupen!! PERDON!!
Encontre uno muy bbueno!!
Se los dejo para que lo vean

Código :

import flash.geom.Point;
import flash.display.BitmapData;

this.onEnterFrame = function():Void  {
   if (red.pixelHitTest(blue)) {
      this.red._alpha = this.blue._alpha = 50;
   } else {
      this.red._alpha = this.blue._alpha = 100;
   }
}

this.red.onPress = this.blue.onPress = startDrag;
this.red.onRelease = this.blue.onRelease = stopDrag;

MovieClip.prototype.pixelHitTest = function(mc:MovieClip):Boolean  {
   var thisBitmap:BitmapData = new BitmapData(this._width, this._height, true, 0);
   thisBitmap.draw(this);

   var mcBitmap:BitmapData = new BitmapData(mc._width, mc._height, true, 0);
   mcBitmap.draw(mc);   
   
   if(thisBitmap.hitTest(new Point(this._x, this._y), 0xFF, mcBitmap, new Point(mc._x, mc._y))) {
      return true;
   }
   return false;   
}


Noo tengo mucho tiempo para esplicarlo, si quieren solo digan

Por JaLeRu

Claber

1913 de clabLevel

7 tutoriales

Genero:Masculino  

Existo

firefox
Citar            
MensajeEscrito el 20 Abr 2007 03:16 am
Sería bueno que pusieras dónde lo encontraste. No sólo como reconocimiento al autor, sino porque también puede tener otros ejemplos útiles y a más de uno puede interesarle agregar esa web a favoritos.

Por HernanRivas

Claber

3416 de clabLevel

26 tutoriales

 

Argentina

msie
Citar            
MensajeEscrito el 20 Abr 2007 02:37 pm

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox
Citar            
MensajeEscrito el 20 Abr 2007 09:42 pm
Hay un post donde sale un link a una web ..con un ejemplo..No me lo abia lograo descargar..pero...
De ai lo saque...! :D

Por JaLeRu

Claber

1913 de clabLevel

7 tutoriales

Genero:Masculino  

Existo

msie7

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.