예제 #1
0
파일: Element.cs 프로젝트: chestergrant/Ink
 public Element(Texture2D aSprite, Vector2 aPosition,  Vector2 aSpeed, int numFrames)
 {
     activated = false;
     hasBeenHit = -1;
     endSequence = false;
     sprite = aSprite;
     position = aPosition;
     speed = aSpeed;
     frameCounter = 0;
     frameSize = sprite.Width / numFrames;
     drawable = true;
     hasEndingSequence = false;
     ourBox = new CollisionBox(aPosition, new Vector2(aPosition.X + aSprite.Width/numFrames, aPosition.Y + aSprite.Height));
 }
예제 #2
0
        public int Intersect(CollisionBox box)
        {
            int side = -1;
            BoundingBox ex = box.getEntireObject();
            if (ex.Intersects(left))
            {
                side = 1;
            }else if(ex.Intersects(top)){
                side = 2;
            }
            else if (ex.Intersects(right))
            {
                side = 3;
            }
            else if (ex.Intersects(bottom))
            {
                side = 4;
            }

            return side;
        }
예제 #3
0
 public Boolean IntersectRight(CollisionBox box)
 {
     BoundingBox ex = box.getEntireObject();
     return ex.Intersects(right);
 }
예제 #4
0
 public Boolean IntersectBottom(CollisionBox box)
 {
     BoundingBox ex = box.getEntireObject();
     return ex.Intersects(bottom);
 }
예제 #5
0
 public Boolean IntersectTop(CollisionBox box)
 {
     BoundingBox ex = box.getEntireObject();
     Boolean ans = ex.Intersects(top);
     if (ans)
     {
         ans = ans;
     }
     return ans;
 }