示例#1
0
        public bool collisionDetect(AnimateSheetSprite other)
        {
            Rectangle myBound    = new Rectangle((int)this.PixelPosition.X, (int)this.PixelPosition.Y, this.FrameWidth, this.FrameHeight);
            Rectangle otherBound = new Rectangle((int)other.PixelPosition.X, (int)other.PixelPosition.Y, other.FrameWidth, other.FrameHeight);

            return(myBound.Intersects(otherBound));
        }
示例#2
0
 public virtual void Follow(AnimateSheetSprite followed)
 {
     // Only rotate towards the player if he enters the field of View
     if (followed.BoundingRectangle.Intersects(Range))
     {
         angleOfRotation = TurnToFace(followed.PixelPosition, PixelPosition, angleOfRotation, rotationSpeed);
     }
 }
 public Projectile(Game game, Vector2 userPosition, List <TileRef> projectiletRefs,
                   List <TileRef> explosionRef, int frameWidth, int frameHeight, float layerDepth) : base(game, userPosition, projectiletRefs, frameWidth, frameHeight, layerDepth)
 {
     Target          = Vector2.Zero;
     StartPosition   = userPosition;
     ProjectileState = PROJECTILE_STATE.STILL;
     explosion       = new AnimateSheetSprite(game, userPosition, explosionRef, frameWidth, FrameHeight, layerDepth);
 }
示例#4
0
 public Projectile(Game g, List <TileRef> texture, AnimateSheetSprite rocketExplosion, Vector2 userPosition, int framecount)
     : base(g, userPosition, texture, 64, 64, framecount)
 {
     Target                   = Vector2.Zero;
     myGame                   = g;
     textureCenter            = new Vector2(32, 32);
     explosion                = rocketExplosion;
     explosion.PixelPosition -= textureCenter;
     explosion.Visible        = false;
     StartPosition            = PixelPosition;
     ProjectileState          = PROJECTILE_STATE.STILL;
 }
示例#5
0
        public void AddExplosion()
        {
            Explosion = new AnimateSheetSprite(Game, this.PixelPosition, new List <TileRef>()
            {
                new TileRef(0, 0, 0),
                new TileRef(1, 0, 0),
                new TileRef(2, 0, 0),
            }, 64, 64, 0f);

            explosion.PixelPosition -= textureCenter;
            explosion.Visible        = false;
            explosion.DrawOrder      = 2;
        }