예제 #1
0
        public FallDown()
        {
            player = new Player();
            player.Active = true;
            player.Visible = true;
            player.Value = "Player";
            player.Position = Vector2.One;

            Background = new GameObject[2];
            Background[0] = new GameObject();
            Background[0].Position = Vector2.Zero;
            Background[1] = new GameObject();
            Background[1].Position = new Vector2(0, 485);

            GameObjects = new List<GameObject>();
            loadPowerups();
            GameObjects.Add(player);

            gameBegin = 0;
            HighScore = 0;
            bonus = 0;
            arrowFrame = 0;

            firstRun = true;
            PlayState = "Menu";

            rows = new List<Row>();

            Random r = new Random();
            for (int i = 0; i < 5; i++)
            {
                Row row = new Row();
                row.YPosition = i * 100 + 300;
                row.CreateBlocks(r);
                row.Randomize(r);
                rows.Add(row);
            }
            ScreenOrientation = ScreenOrientation.Portrait;

            SoundEffects = new List<SoundEffect>();
        }
예제 #2
0
        private void loadPowerups()
        {
            GameObject freezePowerup = new GameObject();
            freezePowerup.Visible = false;
            freezePowerup.Value = "freeze";
            freezePowerup.Duration = 3;
            GameObjects.Add(freezePowerup);

            GameObject speedPowerup = new GameObject();
            speedPowerup.Visible = false;
            speedPowerup.Value = "speed";
            speedPowerup.Duration = 3;
            GameObjects.Add(speedPowerup);

            GameObject drillPowerup = new GameObject();
            drillPowerup.Visible = false;
            drillPowerup.Value = "drill";
            drillPowerup.Duration = 2;
            GameObjects.Add(drillPowerup);

            GameObject scorePowerup = new GameObject();
            scorePowerup.Visible = false;
            scorePowerup.Value = "score";
            GameObjects.Add(scorePowerup);

        }