hi there, 

I'm experimenting a game using google maps api. In the game you control 
a plane and you have to destruct the enemy bases with some bullets . 
And im having big problems detect the colisions ( intersection of to 
poligons ). i use the function *intersects* of the* LatLngBounds *witch 
dosent work to well. 
after that i use a codesnippet for detecting is 2 poligons intersects but it 
works worst ( i dont know if i can use with geographical coordinates) 

public function atualizaPos(e:Event)
{
i++;
if (i < percurso.length)
{
marker.setLatLng(percurso[i]);

var limiteNave = new LatLngBounds(new LatLng(mapa.getCentro().x - 0.002 , 
mapa.getCentro().y-0.005),
    new LatLng(mapa.getCentro().x + 0.004 , mapa.getCentro().y+0.005));
var limiteBala = new LatLngBounds(percurso[i - 1],percurso[i]);


if (tipo == "daNave")
{
for (var j = 0; j < basses.length; j++)
{
var posBase:LatLng = basses[i];
var limiteBase = new LatLngBounds(new LatLng(posBase.lat()-0.0015 , 
posBase.lng()-0.0015),
   new LatLng(posBase.lat()+0.0015 , posBase.lng()+0.0015)
   );

if (limiteBala.intersects(limiteBase)  )
{
trace("coli Nave - > Base");
 }
   if( limiteBase.getNorthWest().lat() < limiteBala.getSouthEast().lat() &&
    limiteBase.getSouthEast().lat() > limiteBala.getNorthWest().lat() &&
limiteBase.getNorthWest().lng() < limiteBala.getSouthEast().lng() &&
    limiteBase.getSouthEast().lng() > limiteBala.getNorthWest().lng() ){
trace("COLI");
  }
  }
}


}
else
{
mapa.getMapa().removeOverlay(marker);
}
}


}


this is the function the updates the position of the bullet ("bala"), and 
where i check if collides it the enemy  bases... 

Can any one help me ?? 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-api-for-flash/-/f8EfbJMBvAsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en.

Reply via email to