示例#1
0
        /// <summary>
        /// Processes entity events.
        /// </summary>
        public override void ProcessEvents()
        {
            ProcessMovement();

            if (PolygonCollisions.Collides(Hitbox, GameObjects.Player.Grazebox))
            {
                Remove = true;
                switch (_itemType)
                {
                case ItemType.BigPower:
                    GameScores.IncrementPower(5);
                    GameScores.SCORE += GameScores.POINTS[GameScores.ITERATOR];
                    break;

                case ItemType.Bomb:
                    GameScores.BOMB++;
                    break;

                case ItemType.FullPower:
                    GameScores.POWER  = 128;
                    GameScores.SCORE += GameScores.POINTS[GameScores.ITERATOR];
                    break;

                case ItemType.Life:
                    GameScores.PLAYER++;
                    break;

                case ItemType.Point:
                    GameScores.BONUS++;
                    break;

                case ItemType.Power:
                    GameScores.IncrementPower(1);
                    GameScores.SCORE += GameScores.POINTS[GameScores.ITERATOR];
                    break;

                case ItemType.Star:
                    GameScores.SCORE += 500 + (10 * (GameScores.GRAZE / 3));
                    break;
                }
            }

            //TODO: Fire
        }
        /// <summary>
        /// Main access point for the program.
        /// </summary>
        public static void Main()
        {
            //Open game window.
            SwinGame.OpenGraphicsWindow(_title + " v" + _version, 800, 600);

            //Load game assets.
            GameResources.LoadResources();
            GameObjects.LoadGameOjects();

            //Initaliase game assets.
            ScreenControler.SetScreen("StartupMenu");
            ScreenControler.Initalise();
            Settings.InitSettings();
            GameScores.InitForNewGame();

            //Show SwinGame splash screen.
            if (_splashFlag)
            {
                SwinGame.ToggleFullScreen();
                SwinGame.ShowSwinGameSplashScreen();
            }

            //Run game loop.
            while (!SwinGame.WindowCloseRequested() && !Settings.EXIT)
            {
                //Fetch the next batch of UI interaction
                SwinGame.ProcessEvents();
                ScreenControler.Screen.ProvessEvents();

                //Draw Game
                ScreenControler.Screen.Draw();
                SwinGame.RefreshScreen(60);
            }

            //Free game assets.
            GameResources.FreeResources();
        }