/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here IsMouseVisible = true; mCowSprite = new Cows();//initialise instance mPlayerSprite = new PlayerFan(); mPlayerScoreSprite = new PlayerScore(); mMusicSounds = new GameMusicSounds(); gameOver = new GameOverScreen(); startButtonPosition = new Vector2((GraphicsDevice.Viewport.Width / 2) - 50, 200); exitButtonPosition = new Vector2((GraphicsDevice.Viewport.Width / 2) - 50, 250); GameState currentGameState = GameState.MainMenu;//when game loads, it's set to MainMenu //get the mouse state mouseState = Mouse.GetState(); previousMouseState = mouseState; base.Initialize(); }
public void checkIfCowShouldSpawn() { //if timer == 100. add cow. reset timer int randomCowPositionX; //random position which cow will be placed at, along the X axis GameWideMethods GWM = new GameWideMethods(); if (spawnTimer == 100) { Cows mCowInList = new Cows(); mCowInList.LoadContent(this.Content, "cowSprite"); randomCowPositionX = GWM.randomNumer(1109); mCowInList.cowPosition.X = randomCowPositionX; mCowSprites.Add(mCowInList); spawnTimer = 0;//reset //RNG IN HERE. INTERACT WITH RANDOM METHOD CLASS WIDE. //CHANGE COWPOSITION BEFORE ADDING TO LIST? } }