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)); }
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); }
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; }
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; }