示例#1
0
文件: Cuerpo.cs 项目: JDBS/Roguelike
        public bool detectarColision(Posicion pos_cuerpo, Posicion pos_colision)
        {
            if (tx_.getSizeX() <= 0 || tx_.getSizeY() <= 0)
            {
                return(false);   //si no tienen volumen no pueden colisionar
            }

            if (tx_.getSizeX() == 1 && tx_.getSizeY() == 1)
            {
                return(pos_cuerpo == pos_colision);     //si su tamaño es 1 solo se compara una posición.
            }
            else
            {
                //crea una region y la usa como caja de colisiones
                Region CajaColision = new Region(getBII(pos_cuerpo), getBSD(pos_cuerpo));

                //true si la posicion está en la región
                return(CajaColision.checkPointInRegion(pos_colision));
            }
        }
示例#2
0
文件: Cuerpo.cs 项目: JDBS/Roguelike
 public Cuerpo(int centro_x, int centro_y, Textura tx)
 {
     tx_ = tx;
     if (centro_x >= 0 && centro_y >= 0)
     {
         if (centro_x < tx_.getSizeX() && centro_y < tx_.getSizeY())
         {
             cent_ = new Offset(centro_x, centro_y);
         }
         else
         {
             cent_ = new Offset();
         }
     }
     else
     {
         cent_ = new Offset();
     }
 }