Ejemplo n.º 1
0
        public LevelEnd()
        {
            levelEnded = new XNACS1Rectangle(XNACS1Base.World.WorldDimension / 2, XNACS1Base.World.WorldDimension.X, XNACS1Base.World.WorldDimension.Y);
            levelEnded.Color = Color.Black;

            mainLabel = new XNACS1Rectangle();
            mainLabel.Color = Color.Black;
            mainLabel.LabelColor = Color.White;

            timeLabel = new XNACS1Rectangle();
            timeLabel.Label = "Time Elapsed:";
            timeLabel.Color = Color.Black;
            timeLabel.LabelColor = Color.White;

            coinLabel = new XNACS1Rectangle();
            coinLabel.Label = "Coins Saved:";
            coinLabel.Color = Color.Black;
            coinLabel.LabelColor = Color.White;

            componentLabel = new XNACS1Rectangle();
            componentLabel.Label = "Components Used:";
            componentLabel.Color = Color.Black;
            componentLabel.LabelColor = Color.White;

            scoreLabel = new XNACS1Rectangle();
            scoreLabel.Label = "TOTAL SCORE:";
            scoreLabel.Color = Color.Black;
            scoreLabel.LabelColor = Color.White;

            timeStars = new XNACS1Rectangle[5];
            timeStars[0] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            timeStars[1] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            timeStars[2] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            timeStars[3] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            timeStars[4] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");

            coinStars = new XNACS1Rectangle[5];
            coinStars[0] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            coinStars[1] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            coinStars[2] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            coinStars[3] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            coinStars[4] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");

            componentStars = new XNACS1Rectangle[5];
            componentStars[0] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            componentStars[1] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            componentStars[2] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            componentStars[3] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            componentStars[4] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");

            finalScoreStars = new XNACS1Rectangle[5];
            finalScoreStars[0] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            finalScoreStars[1] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            finalScoreStars[2] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            finalScoreStars[3] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");
            finalScoreStars[4] = new XNACS1Rectangle(new Vector2(-20, -20), 10, 10, "star");

            this.Hide();
        }
        public WallSet( Vector2 origin)
        {
            RoomWalls = new XNACS1Rectangle[4];

            roomMin = origin;

            roomMax = new Vector2(origin.X  + 100f, origin.Y + (9f/16f)*100f);
            allWalls = new XNACS1PrimitiveSet();
            InitializeWalls();
            allWalls.RemoveAllFromAutoDrawSet();
        }
Ejemplo n.º 3
0
        public virtual void Update()
        {
            switch( this.state)
            {
                case(BallState.Moving):

                    this.ticks_to_die--;

                    /*rotate circle based on movement in X direction*/
                    float xDisplacement = (this.VelocityX / this.Radius) * 180f / (float)Math.PI;
                    this.RotateAngle -= xDisplacement;

                    this.VelocityY += -1f * WorldPhysics.Gravity;

                    if (this.ticks_to_die <= 0)
                    {
                        this.state = BallState.Dying;
                        this.ticks_to_die = 40;         // reset for poof effect to use.
                        this.RemoveFromAutoDrawSet();

                        // set up poofs
                        this.poofs = new XNACS1Rectangle[9];

                        float velDir = XNACS1Base.RandomFloat(-45, 0);
                        for (int i = 0; i < poofs.Length - 1; i++)
                        {
                            float newSize = XNACS1Base.RandomFloat(3, 7);
                            poofs[i] = new XNACS1Rectangle(this.Center, newSize, newSize, "poofCloud");
                            poofs[i].RotateAngle = XNACS1Base.RandomFloat(0,360);

                            velDir += 45;
                            poofs[i].VelocityDirection = new Vector2((float)Math.Cos(velDir), (float)Math.Sin(velDir));
                            poofs[i].Speed = XNACS1Base.RandomFloat(0.25f, 0.5f);
                            // poofs[i].ShouldTravel = true;
                        }

                        this.poofs[poofs.Length - 1] = new XNACS1Rectangle(this.Center, this.SizeX + 1, this.SizeY + 1, "poof");
                    }

                    break;

                case(BallState.Dying):

                    this.ticks_to_die--;

                    // the moving poofs.
                    for (int i = 0; i < poofs.Length - 1; i++)
                    {
                        poofs[i].Center += poofs[i].VelocityDirection * poofs[i].Speed;
                        poofs[i].Height *= 1.005f;
                        poofs[i].Width *= 1.005f;
                    }

                    // and the final stationary poof
                    this.poofs[poofs.Length - 1].Height *= 1.005f;
                    this.poofs[poofs.Length - 1].Width *= 1.005f;

                    if (this.ticks_to_die <= 0)
                    {
                        // all done...
                        this.state = BallState.Hidden;

                        for (int i = 0; i < poofs.Length; i++)
                        {
                            poofs[i].RemoveFromAutoDrawSet();
                            poofs[i] = null;
                        }

                        // remove the coin from the spawner's list...
                        Spawner.removeMoney = true;
                    }

                    break;
            }
        }