protected override void Initialize() { controllerList = new List<IController> { new KeyboardController() }; SpriteBatch = new SpriteBatch(GraphicsDevice); graphics.PreferredBackBufferHeight = (int)(Utility.SCREEN_WIDTH * Utility.CAMERA_SCALE); graphics.PreferredBackBufferWidth = (int)(Utility.SCREEN_HEIGHT * Utility.CAMERA_SCALE); graphics.ApplyChanges(); IsMouseVisible = true; Mario = new Mario(Vector2.Zero); Mario.CurrentState = new JumpingMarioState(true, Utility.SMALL, Mario); Components.Add(Mario); background = new BackgroundImageCollection(); Components.Add(background); delay = Utility.GAME_LOAD_DELAY; overlay = new Overlay(); Components.Add(overlay); CollisionDetectionManager.Initialize(); BoggusLoader.LoadQuotes("quotes.txt"); //level = new Level("Level1.csv"); //level = new InfiniteLevel(); Camera.Initialize(); SoundManager.Initialize(this); HighScore.Initialize(); BulletBillMachine.Initialize(this); if (initialLoadup) { CurrentGameState = GameState.LevelSelect; cursor = new Cursor(); levelSelect = new LevelSelectController(); levelSelectGP = new LevelSelectGamePadController(); } else { if (CurrentGameState != GameState.Lost) { CurrentGameState = GameState.Loading; } if (LevelIsInfinite) level = new InfiniteLevel(); else { level = new Level("Level1.csv"); Components.Add(new Collectibles.Rifle(Vector2.One * 200)); } } Paused = true; base.Initialize(); }
void InitializeObjects() { SpriteBatch = new SpriteBatch(GraphicsDevice); Mario = new Mario(new Vector2(400, 400)); Mario.CurrentState = new JumpingMarioState(true, 2, Mario); Components.Add(Mario); background = new BackgroundImageCollection(); Components.Add(background); overlay = new Overlay(); Components.Add(overlay); CollisionDetectionManager.Initialize(); level = new Level("Level1.csv"); //Camera must be initialized after Level Camera.Initialize(); SoundManager.Initialize(this); }
public BackgroundImageCollection() : base(SprintFourGame.GetInstance()) { //Background always draws first (immediate mode) DrawOrder = Utility.BACKGROUND_DRAW_ORDER; instance = this; }