Ejemplo n.º 1
0
        public TestRoom(Engine a, int layer)
            : base(a, layer)
        {
            a.console.RegisterStateCommands(this);
            a.console.RegisterStateCommands(pe);
            a.console.Execute("fps true");

            player = new Player(a, new Vector2(100f, 100f));
            objects.Add(player);

            Particle p = new EmitterParticle(pe, new Vector2(a.resolution.X / 4 * 3, a.resolution.Y * 3 / 4 + 50), delegate(Particle emitter, ParticleEngine engine)
            {
                Particle tail = new SpriteParticle(engine, Resources.GetSprite("p_explosion"), emitter.position, Color.Orange);
                tail.rotation = (float)(MathExtra.random.NextDouble() * Math.PI * 2);
                tail.SetLife(150);
                tail.alpha = 0;
                tail.methods.Add(new FadeInOutMethod(engine));
                tail.methods.Add(new ScaleMethod(engine, 0.15f, 0.01f));
                engine.AddParticle(tail, true);
            });

            p.methods.Add(new PointForceMethod(pe, new Vector2(a.resolution.X / 4 * 3 + 50, a.resolution.Y * 3 / 4 + 50), 0.5f));
            p.velocity = new Vector2(0.0f, -10.0f);
            pe.AddParticle(p);
        }
Ejemplo n.º 2
0
 private Particle Defaultemitterroutine(BCBlockGameState gstate, EmitterParticle source, int framenum, int ttl)
 {
     FireParticle p = new FireParticle(new PointF(source.Location.X, source.Location.Y));
     p.TTL = 60;
     p.Velocity = BCBlockGameState.GetRandomVelocity(0, 2);
     return p;
 }
Ejemplo n.º 3
0
        public override bool Powerup_PerformFrame(BCBlockGameState gamestate)
        {
            GravityEffect = new PointF(0, 0);
            if (gsw == null) gsw = new GameStopwatch(gamestate);
            //throw new NotImplementedException();
            //Location = new PointF(Location.X + Velocity.X, Location.Y + Velocity.Y);

            //get current time...
            long elapsedticks = gsw.Elapsed.Ticks;
            long lengthticks = Poptime.Ticks;

            //first, if our time is up, we're done.
            if (elapsedticks > lengthticks || Math.Abs(Velocity.Y) < 0.1f)
            {
                //spawn some particles.
                for (int i = 0; i < 10; i++)
                {
                    EmitterParticle createdemitter = new EmitterParticle(this.GetRectangleF().CenterPoint(), Defaultemitterroutine);
                    createdemitter.Velocity = BCBlockGameState.GetRandomVelocity(0, 5);
                    gamestate.Particles.Add(createdemitter);

                }
                gamestate.SpawnOrbs(45, GetRectangleF().CenterPoint(), typeof(MacGuffinOrb));
                gamestate.NextFrameCalls.Enqueue(new BCBlockGameState.NextFrameStartup(() => gamestate.GameObjects.Remove(this)));
                return true; //destroy us NAU...
            }
            else
            {

                //get percentage through...
                float percentcomplete = ((float)elapsedticks) / ((float)lengthticks);

                //set velocity.Y to -(1-Sin(percentcomplete)...
                //Velocity = new PointF(Velocity.X, -2*(float)(Math.Abs(1 - Math.Sin(percentcomplete))));
                if(Velocity.Y < 0)
                    Velocity = new PointF(Velocity.X, Velocity.Y +0.5f);

                Debug.Print("percentage through:" + percentcomplete + Velocity);
            }
            Debug.Print("Velocity is " + Velocity);

            return false;
        }