public Boolean collidesWithCollisionBox(CollisionBox box)
        {
            Vector2 playerPoint = getCenter();

            return(box.collidesWithMovingPoint(getCenter(), speed));

            return(playerPoint.X > box.getCenter().X - box.size.X * 0.5f && playerPoint.X < box.getCenter().X + box.size.X * 0.5f &&
                   playerPoint.Y > box.getCenter().Y - box.size.Y * 0.5f && playerPoint.Y < box.getCenter().Y + box.size.Y * 0.5f);
        }
Beispiel #2
0
 public Boolean collidesLeftWithCollisionBox(CollisionBox box)
 {
     foreach (Vector2 point in leftPoints())
     {
         Vector2 playerPoint = point;
         if (box.collidesWithMovingPoint(playerPoint, getMovingVector()))
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #3
0
        public Boolean collidesUpWithCollisionBox(CollisionBox box)
        {
            Vector2 playerPoint = upPoint();

            return(box.collidesWithMovingPoint(playerPoint, getMovingVector()));
        }
Beispiel #4
0
        public Boolean collidesDownWithCollisionBox(CollisionBox box)
        {
            Vector2 playerPoint = downPoint() + WorldInfo.gravity * 0.1f;

            return(box.collidesWithMovingPoint(playerPoint, getMovingVector()));
        }