/** Create a new sparkle group */ public void CreateSparkles(float[] Position, float[] Velocity) { var factory = new SparkFactory() { Source = new float[2] { Position[0], Position[1] }, Lifespan = 0.5f, LifespanVar = 0.1f, Count = _realRate, CountVar = _realRate / 2, Tint = new float[4] { 1.0f, 1.0f, 1.0f, 1.0f } }; factory.VelocityVar [2] = nRand.Float(0f, 50f); factory.Velocity [0] = Velocity [0] * 0.5f; factory.Velocity [1] = Velocity [1] * 0.5f; factory.VelocityVar [0] = Math.Sign(factory.Velocity [0]) * 3f; factory.VelocityVar [1] = Math.Sign(factory.Velocity [1]) * 3f; factory.Tint = new float[4] { 1.0f, 1.0f, 0.0f, 1.0f }; var items = factory.Manufacture(); foreach (var i in items) { var m = new nMotion(i, new RainbowSparkAnim()); Sparkles.Add(m); } }
private void Init() { _motion = new nMotionVector() { MaxLength = MaxLength, SegmentSize = SegmentSize }; _trail = new nTrail((int) (MaxLength / SegmentSize)) { MinWidth = MinWidth, MaxWidth = MaxWidth }; var m = new nMotion(_trail, new ForeverAnim()); _sprites.Add(m); _ready = true; }
public void Manufacture(Collectables parent) { var m = new nMotion(MakeTwinkle(parent), MakeTwinkleAnim()); _twinks.Add(m); parent.Twinkles.Add((Twinkle) m.Parent); }
/** Create a score node */ public void CreateScore(Twinkle parent) { var sc = new ScoreDsp() { Position = new float[2] { parent.Position[0], parent.Position[1] }, Size = new float[2] { 6f, 3f }, Float = 5.0f }; var m = new nMotion(sc, new ScoreAnim() { Lifespan = 2f }); _scores.Add(m); _parent.Trigger(new CollectableHit(_parent, parent.Points)); }
/** Create a new sparkle group */ public void CreateSparkles(float[] Position, float[] Velocity, SparkleType type) { var factory = new SparkFactory() { Source = new float[2] { Position[0], Position[1] }, Velocity = new float[3] { Velocity[0], Math.Sign(Velocity[1]) * 10f, 0f }, Lifespan = 1.0f, LifespanVar = 0.5f, Count = 10, CountVar = 2, Tint = new float[4] { 1.0f, 1.0f, 1.0f, 1.0f } }; /* Custom per type */ factory.VelocityVar [2] = nRand.Float(0f, 50f); if (type == SparkleType.SPARKLE_WALL) { factory.Velocity [1] = 0; factory.Velocity [0] = Math.Sign(Velocity [0]) * 10f; factory.VelocityVar [0] = 20f; factory.VelocityVar [1] = 30f; factory.Tint = new float[4] { 0.5f, 0.5f, 1.0f, 1.0f }; } else { factory.Velocity [0] = Velocity [0]; factory.Velocity [1] = Math.Sign(Velocity [1]) * 10f; factory.VelocityVar [0] = 20f; factory.VelocityVar [1] = 30f; factory.Tint = new float[4] { 1.0f, 1.0f, 0.5f, 1.0f }; } var items = factory.Manufacture(); foreach (var i in items) { var m = new nMotion(i, new SparkAnim()); _sparkles.Add(m); } }
/** Add a sprite to the cluster */ public void Add(nMotion sprite) { _mobiles.Add(sprite); }