public TrailParticle(Entity source, Color color) { Texture = GameWorld.ParticleSpriteSheet; CollRectangle = new Rectangle(source.GetCollRectangle().Center.X, source.GetCollRectangle().Center.Y, 8, 8); SourceRectangle = new Rectangle(8, 0, 8, 8); int buffer = 1; Velocity.X = GameWorld.RandGen.Next((int)-source.GetVelocity().X - buffer, (int)-source.GetVelocity().X + buffer + 1) * (float)GameWorld.RandGen.NextDouble(); Velocity.Y = GameWorld.RandGen.Next((int)-source.GetVelocity().Y - buffer, (int)-source.GetVelocity().Y + buffer + 1); Position = new Vector2(CollRectangle.X, CollRectangle.Y); Opacity = .5f; light = new Lights.DynamicPointLight(this, .5f, false, color, 1); GameWorld.Instance.LightEngine.AddDynamicLight(light); }
/// <summary> /// Generates specified number of gems in gameworld. /// </summary> /// <param name="count"></param> /// <param name="entity"></param> public static void Generate(int count, Entity entity) { for (int i = 0; i < count; i++) { Gem gem = new Gem(entity.GetCollRectangle().Center.X, entity.GetCollRectangle().Center.Y); GameWorld.Instance.Entities.Add(gem); } }
public StompSmokeParticle(Entity entity) { Texture = ContentHelper.LoadTexture("Effects/smoke"); CollRectangle = new Rectangle(entity.GetCollRectangle().Center.X - 4, entity.GetCollRectangle().Bottom - 4, 8, 8); SourceRectangle = new Rectangle(8 * GameWorld.RandGen.Next(0, 4), 0, 8, 8); Position = new Vector2(CollRectangle.X, CollRectangle.Y); Velocity.X = (float)GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-3, 3); Velocity.Y = (float)GameWorld.RandGen.NextDouble() * -1f; Opacity = 1f; }
public static void Generate(int count, Entity entity) { for (int i = 0; i < count; i++) { int x = GameWorld.RandGen.Next(entity.GetCollRectangle().X, entity.GetCollRectangle().X+ entity.GetCollRectangle().Width - 4); int y = GameWorld.RandGen.Next(entity.GetCollRectangle().Y, entity.GetCollRectangle().Y + entity.GetCollRectangle().Height - 4); TestSmokeParticle par = new TestSmokeParticle(x, y); GameWorld.Instance.Particles.Add(par); } }
public SparkParticle(Entity source, Color color) { SourceRectangle = new Rectangle(272, 96, 8, 8); Texture = GameWorld.SpriteSheet; CollRectangle = new Rectangle(source.GetCollRectangle().X - 4, source.GetCollRectangle().Y + 4, 8, 8); Velocity.X = GameWorld.RandGen.Next(-6, 7); Position = new Vector2(CollRectangle.X, CollRectangle.Y); Opacity = .7f; light = new DynamicPointLight(this, .05f, false, color, .5f); GameWorld.Instance.LightEngine.AddDynamicLight(light); }
public EntityFlameParticle(Entity source, Color color) { SourceRectangle = new Rectangle(32 * 8, 12 * 8, 8, 8); Texture = GameWorld.SpriteSheet; int randX = (int)(GameWorld.RandGen.Next(0, source.GetCollRectangle().Width) * GameWorld.RandGen.NextDouble()); int randY = (int)(GameWorld.RandGen.Next(0, source.GetCollRectangle().Height) * GameWorld.RandGen.NextDouble()); CollRectangle = new Rectangle(source.GetCollRectangle().X + randX - 4, source.GetCollRectangle().Y + randY - 4, 8, 8); Position = new Vector2(CollRectangle.X, CollRectangle.Y); Opacity = .5f; Velocity.X = (float)(GameWorld.RandGen.Next(-1, 2) * GameWorld.RandGen.NextDouble()); Velocity.Y = -3f; light = new DynamicPointLight(this, .5f, false, color, .5f); GameWorld.Instance.LightEngine.AddDynamicLight(light); }
public void CreateTookDamage(Entity entity) { CurrentParticle = ParticleType.TookDamage; Texture = ContentHelper.LoadTexture("Sparkles"); CollRectangle = new Rectangle(GameWorld.RandGen.Next(entity.GetCollRectangle().X, entity.GetCollRectangle().Right - 8), GameWorld.RandGen.Next(entity.GetCollRectangle().Y, entity.GetCollRectangle().Bottom - 8), 8, 8); SourceRectangle = new Rectangle(0, 0, 8, 8); Velocity.X = (float)(GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-4, 5)); Velocity.Y = (float)(GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-1, 2)); Position = new Vector2(CollRectangle.X, CollRectangle.Y); Opacity = 1; color = Color.Red; }
public void CreateDeathSmoke(Entity entity) { CurrentParticle = ParticleType.DeathSmoke; Texture = ContentHelper.LoadTexture("Effects/smoke"); CollRectangle = new Rectangle(GameWorld.RandGen.Next(entity.GetCollRectangle().X, entity.GetCollRectangle().Right - 16), GameWorld.RandGen.Next(entity.GetCollRectangle().Y, entity.GetCollRectangle().Bottom - 16), 16, 16); SourceRectangle = new Rectangle(GameWorld.RandGen.Next(0, 4) * 16, 0, 16, 16); Velocity.X = (float)(GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-2, 3)); Velocity.Y = -.5f; Position = new Vector2(CollRectangle.X, CollRectangle.Y); Opacity = 2; }
public MachineGunParticle(Entity source, int xCoor) { SourceRectangle = new Rectangle(264, 96, 8, 8); Texture = GameWorld.SpriteSheet; CollRectangle = new Rectangle(source.GetCollRectangle().X + xCoor - 4, source.GetCollRectangle().Y + 4, 8, 8); Position = new Vector2(CollRectangle.X, CollRectangle.Y); Opacity = 1f; Velocity.Y = -8f; _hitSound = new SoundFx("Sounds/Machine Gun/bulletHit",this); light = new DynamicPointLight(this, .05f, false, Color.White, .5f); GameWorld.Instance.LightEngine.AddDynamicLight(light); }