public Fireball(float x, float y, Boolean moveLeft, float scale) : base(x, y) { hitBaddies = new LinkedList<Unit>(); this.scale = scale; if (scale > 1) { this.damage = 100; } this.moveLeft = moveLeft; if (moveLeft) { this.xSpeed = -5; spriteEffect = SpriteEffects.FlipHorizontally; } else { this.location.X += 86; spriteEffect = SpriteEffects.None; this.xSpeed = 5; } this.texture = AkumaContentManager.fireballTex; LinkedList<Texture2D> textures = new LinkedList<Texture2D>(); hitBaddies = new LinkedList<Unit>(); textures.AddLast(AkumaContentManager.circleParticle); this.emitter = ParticleEmitterManager.GetInstance().AddEmitter(ParticleEmitterManager.EmitterType.Point, textures, new Vector3(location.X, location.Y, 0.11f), new Vector3(xSpeed, 0f, 0f), 1 * (int)scale, new Vector2(3f, 0f), scale, -1, Color.Red); this.emitter2 = ParticleEmitterManager.GetInstance().AddEmitter(ParticleEmitterManager.EmitterType.Point, textures, new Vector3(location.X, location.Y, 0.11f), new Vector3(xSpeed, 0f, 0f), 2 * (int)scale, new Vector2(3f, 0f), scale, -1, Color.Orange); }
public override void Update(GameTime gt) { if (stuck) { location += speed; if (this.GetRectangle().Intersects(tongue.source.GetRectangle())) { Game1.GetInstance().currentLevel.creaturesToRemove.AddLast(this); Game1.GetInstance().currentLevel.AddTombstone(this); Game1.GetInstance().currentLevel.powerUps.AddLast(new BigFireball(new Vector2(this.location.X + 50, 330))); LinkedList<Texture2D> textures = new LinkedList<Texture2D>(); textures.AddLast(AkumaContentManager.circleParticle); ParticleEmitterManager.GetInstance().AddEmitter(ParticleEmitterManager.EmitterType.Point, textures, new Vector3(location.X + 60, location.Y + 50, 0.009f), new Vector3(0f, 0f, 0f), 50, new Vector2(4f, 2f), 1f, 5, Color.Red); } return; } if (!jumping && random.Next(100) < 5) { jumping = true; } if (random.Next(100) > 95 && directionChanged == 0) { ChangeDirection(); } if (jumping) { jumpCount += 0.25; if (jumpCount >= 4) { jumpCount = 0; jumping = false; } location.X += speed.X * 2; } else { walkCount += 0.25; if (walkCount >= 3) { walkCount = 0; } location.X += speed.X; } if ((location.X <= 5 && effects == SpriteEffects.None) || (location.X + textureWidth >= 1595 && effects == SpriteEffects.FlipHorizontally)) { ChangeDirection(); } if (directionChanged > 0) { directionChanged--; } if (onFire && fireEmitter == null) { LinkedList<Texture2D> textures = new LinkedList<Texture2D>(); textures.AddLast(AkumaContentManager.fireball2Tex); fireEmitter = ParticleEmitterManager.GetInstance().AddEmitter(ParticleEmitterManager.EmitterType.Point, textures, new Vector3(location.X + 60, location.Y + 50, 0.12f), new Vector3(0f, 0f, 0f), 3, new Vector2(2f, 0f), 0.2f, -1, Color.White); } if (fireEmitter != null) { fireEmitter.location.X = location.X + 60; fireEmitter.location.Y = location.Y + 50; life--; } if (life <= 0) { fireEmitter.Dispose(); Game1.GetInstance().currentLevel.creaturesToRemove.AddLast(this); Game1.GetInstance().currentLevel.AddTombstone(this); if (random.Next(500) < 2) { Game1.GetInstance().currentLevel.powerUps.AddLast(new BigFireball(new Vector2(this.location.X + 50, 330))); } } }