コード例 #1
0
        public void Initialize()
        {
            mediaInitialized = false;

            Screen = new WriteableBitmap(Width, Height);
            TitleScreen = new TitleScreen(this);
            GameScreen = new GameScreen(this);
            InstructionScreen = new InstructionScreen(this);
            GameOverScreen = new GameOverScreen(this);

            ChangeToTitleScreen();
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: tdicola/blacknectar_2ndhalf
        public void Initialize(BlackNectarGame game, GameScreen gameScreen)
        {
            this.game = game;
            this.gameScreen = gameScreen;

            Y = game.Height - 1 - PlayerHeight - PlayerMargin;
            X = (game.Width / 2.0f) - (PlayerWidth / 2.0f);
            XVelocity = 0;

            Energy = EnergyMax;
            EnergyBarHeight = game.Height - (2 * EnergyBarMargin) - PlayerHeight - PlayerMargin;
            EnergyBarLeft = game.Width - 1 - EnergyBarWidth - EnergyBarMargin;
            EnergyBarRight = EnergyBarLeft + EnergyBarWidth;
            EnergyBarBottom = game.Height - 1 - PlayerMargin - PlayerHeight - EnergyBarMargin;

            barBlink = false;
            barBlinkTimer = new PeriodicTimer();
            barBlinkTimer.Period = 0.4f;
            barBlinkTimer.OnChange += () =>
                {
                    barBlink = !barBlink;
                };
        }