//Response Methods public void ChangeDirection() { if (spriteOrientation == SpriteOrientation.Up) { spriteOrientation = SpriteOrientation.Down; } else if (spriteOrientation == SpriteOrientation.Down) { spriteOrientation = SpriteOrientation.Up; } Velocity = new Vector2(0, -Velocity.Y); isJumping = false; sprite = SpriteFactory.GetSpiderSprite(this.spriteOrientation); }
public SpiderEnemy(Rectangle position, int power, int speed, int jumpFrequency, SpriteOrientation spriteOrientation, CollisionType collisionType, string message) { this.Position = new Vector2(position.X, position.Y); this.Size = new Vector2(position.Width, position.Height); this.Power = power; this.Velocity = new Vector2(0, (spriteOrientation == SpriteOrientation.Up ? -1 : 1) * speed); this.isJumping = false; this.jumpFrequency = jumpFrequency; this.jumpCurrent = 0; this.IsAlive = true; this.ShouldNotifyReceivers = false; this.spriteOrientation = spriteOrientation; this.sprite = SpriteFactory.GetSpiderSprite(this.spriteOrientation); this.CollisionType = collisionType; this.MessageToReceivers = message; }