Example #1
0
        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);
        }
Example #2
0
        public JumpSmokeParticle(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 - (int)entity.GetVelocity().X / 2, 3 - (int)entity.GetVelocity().X / 2);
            Velocity.Y = (float)GameWorld.RandGen.NextDouble() * -1f;
            Opacity = 1f;
        }