コード例 #1
0
ファイル: TankGame.cs プロジェクト: Stran6/TankGame
        protected override void Initialize()
        {
            this.Window.Title = "Tank Diggity";

            uiManager = new UIManager(this);
            Components.Add(uiManager);

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            soundManager = new SoundManager(this);
            Components.Add(soundManager);
            
            tankPos = new Vector2(60, 785);
            turretPos = new Vector2(tankPos.X + 45, tankPos.Y + 25);
            player1Tank = new Tank(this, tankPos,(float)Math.PI / 2);
            Components.Add(player1Tank);

            tankPos2 = new Vector2(2048 - 140, 785);
            turretPos2 = new Vector2(tankPos2.X + 45, tankPos.Y + 10);
            player2Tank = new Tank(this, tankPos2,-(float)Math.PI / 2);
            Components.Add(player2Tank);

            currentTank = player1Tank;

            camera = new Camera2d(graphics.GraphicsDevice);

            background = new Background(this);
            Components.Add(background);          

            powerUpManager = new PowerUpManager(this);
            Components.Add(powerUpManager);

            power = 0;

            chargingShot = false;
            chargingShot2 = false;
            shotFired = false;
            shotCollided = false;
            turnOver = false;
            gameRunning = false;
            rightSwap = false;
            leftSwap = false;
            debugGame = false;

            controller = GamePad.GetState(PlayerIndex.One);

            base.Initialize();
        }
コード例 #2
0
ファイル: StartScreen.cs プロジェクト: Stran6/TankGame
        public void SetData(ScreenManager.GameState GameState)
        {

            switch (GameState)
            {
                case ScreenManager.GameState.MOVEHINT:
                    textToDraw = "";
                    onStartScreen = false;     
                    break;

                case ScreenManager.GameState.POWERUPHINT:
                    textToDraw = "";
                    break;

                case ScreenManager.GameState.START:
                    textToDraw = "Press ENTER or (A) to begin\nPress Z to enter Debug";
                    onStartScreen = true;
                    break;

                case ScreenManager.GameState.PLAYER1:
                    textToDraw = "Player 1 press ENTER or (A) to begin";
                    onStartScreen = false;
                    break;

                case ScreenManager.GameState.PLAYER2:
                    textToDraw = "Player 2 press ENTER or (A) to begin";
                    onStartScreen = false;

                    break;

                case ScreenManager.GameState.END:
                    textToDraw = "";

                    break;
            }
        }