예제 #1
0
        public virtual void initialize(Game game, InputHandler inputHandler, ControlType controlType)
        {
            input = inputHandler;

            input.Initialize();
            hud.Initialize();

            switch (controlType)
            {
            case ControlType.buttons:
                controls = new ButtonControls();
                break;

            case ControlType.motion:
                controls = new TapControls();
                break;
            }

            level = 1;
            score = 0;
            bonus = 1;

            ColorData.setColors();
            TextureData.setTexture();

            mainGrid    = new GridType(new Vector2(36, 14), new Vector2(20), 10, 19);
            previewGrid = new GridType(new Vector2(12, 426), new Vector2(20), 4, 2);

            mainGrid.initialize();
            previewGrid.initialize();

            random = new Random();

            mainBlock    = randomize();
            previewBlock = randomize();

            controls.initializeInput(input);
            input.addMotion("Pause", new Press(new Rectangle(52, 0, 160, 10)));

            initializeHUD(game.GraphicsDevice);

            fallCounter = new CounterType(data.StartSpeed);
            fallCounter.setEvent(Drop);

            accelFallCounter = new CounterType(5);
            accelFallCounter.setEvent(AccelDrop);

            movementCounter = new CounterType(5);
            movementCounter.setEvent(Move);

            updateCounter = new CounterType(30);
            updateCounter.setEvent(Update);

            bonusCounter = new CounterType(900);
            bonusCounter.setEvent(ReduceBonus);

            game.Components.Add(hud);
        }
예제 #2
0
        public void initialize()
        {
            loadingGrid = new GridType(new Vector2(100, 220), new Vector2(20), 3, 3);

            loadingGrid.initialize();

            block = new TBlock();

            SpawnData spawnPoint = new SpawnData();

            spawnPoint.brick1Vector = new Vector2(0, 1);
            spawnPoint.brick2Vector = new Vector2(1, 1);
            spawnPoint.brick3Vector = new Vector2(2, 1);
            spawnPoint.brick4Vector = new Vector2(1, 2);

            block.SpawnPoint = spawnPoint;

            block.initialize();

            block.normal(loadingGrid);
        }