public SoundFx(Game1 cGame) { fxSounds.Add(cGame.Content.Load<SoundEffect>("songsAndSounds/hit1")); fxSounds.Add(cGame.Content.Load<SoundEffect>("songsAndSounds/hit2")); fxSounds.Add(cGame.Content.Load<SoundEffect>("songsAndSounds/hit3")); fxSounds.Add(cGame.Content.Load<SoundEffect>("songsAndSounds/menu_select")); }
public void Draw(Game1 cGame) { cGame.spriteBatch.Begin(); cGame.spriteBatch.Draw(creditsScreen, new Rectangle(0, 0, 800, 600), new Rectangle(0, creditsY, 800, 600), Color.White); cGame.spriteBatch.End(); //cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied); ///************/ //cGame.spriteBatch.Draw(backgroundImg, new Vector2(0, 0), Color.White); //cGame.spriteBatch.End(); //cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); //cGame.spriteBatch.DrawString(Arial, "Credits ", new Vector2(325.0f, 100.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Programmers: ", new Vector2(125.0f, 225.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Brett Faulds", new Vector2(125.0f, 245.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Daniel Selnick", new Vector2(125.0f, 265.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Even Cheng", new Vector2(125.0f, 285.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Rj McKeenHan", new Vector2(125.0f, 305.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Artist: ", new Vector2(325.0f, 225.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Even Cheng", new Vector2(325.0f, 245.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Brian Maralis", new Vector2(325.0f, 265.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.End(); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Game1 game = new Game1()) { game.Run(); } }
public BackgroundSong(Game1 cGame) { // VVV This is example how to add a song VVV bgSong.Add(cGame.Content.Load<Song>("songsAndSounds/GnG")); bgSong.Add(cGame.Content.Load<Song>("songsAndSounds/cTwn")); MediaPlayer.IsRepeating = false; MediaPlayer.Volume = sVolume / 100; }
// in LoadContent() public Leaderboard(Game1 cGame) { Arial = cGame.Content.Load<SpriteFont>("SpriteFont1"); CircleBar = cGame.Content.Load<Texture2D>("images/Bar/CircleBar"); SquareBar = cGame.Content.Load<Texture2D>("images/Bar/SquareBar"); NeutralBar = cGame.Content.Load<Texture2D>("images/Bar/NeutralBar"); countDownSecs = 5; countDownMins = 5; }
public void drawLeaderboard(Game1 cGame, Master cScore) { Start = "Start Game"; Quit = "Exit Game"; cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); cGame.spriteBatch.DrawString(Arial, Start, new Vector2(400.0f, 200.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); cGame.spriteBatch.DrawString(Arial, Quit, new Vector2(400.0f, 400.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); cGame.spriteBatch.End(); }
public StartMenu(Game1 cGame) { creditsScreen = cGame.Content.Load<Texture2D>("images/Credits"); backgroundImg = cGame.Content.Load<Texture2D>("images/Main_Title"); HowToPlay = cGame.Content.Load<Texture2D>("images/how_to_play"); Start = cGame.Content.Load<Texture2D>("images/Start"); Credits = cGame.Content.Load<Texture2D>("images/Credits_menu"); Exit = cGame.Content.Load<Texture2D>("images/Exit"); htpScreen = cGame.Content.Load<Texture2D>("images/HowToPlay"); backgroundImg2 = cGame.Content.Load<Texture2D>("images/background"); Arial = cGame.Content.Load<SpriteFont>("SpriteFont1"); }
public GameBackground(Game1 cGame) { backgroundToDraw1 = cGame.Content.Load<Texture2D>("images/background"); backgroundToDraw[0] = cGame.Content.Load<Texture2D>("images/BG/bg1"); backgroundToDraw[1] = cGame.Content.Load<Texture2D>("images/BG/bg2"); backgroundToDraw[2] = cGame.Content.Load<Texture2D>("images/BG/bg3"); backgroundToDraw[3] = cGame.Content.Load<Texture2D>("images/BG/bg4"); backgroundToDraw[4] = cGame.Content.Load<Texture2D>("images/BG/bg5"); backgroundToDraw[5] = cGame.Content.Load<Texture2D>("images/BG/bg6"); backgroundToDraw[6] = cGame.Content.Load<Texture2D>("images/BG/bg7"); backgroundToDraw[7] = cGame.Content.Load<Texture2D>("images/BG/bg8"); }
public void Draw(Game1 cGame, Master cScore) { update(); cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied); cGame.spriteBatch.Draw(backgroundImg, new Vector2(0, 0), Color.White); cGame.spriteBatch.End(); player1Score = "Player 1 Score: " + cScore.returnScore[0]; player2Score = "Player 2 Score: " + cScore.returnScore[1]; cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); cGame.spriteBatch.DrawString(Arial, player1Score, new Vector2(325.0f, 300.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); cGame.spriteBatch.DrawString(Arial, player2Score, new Vector2(325.0f, 320.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); cGame.spriteBatch.End(); }
public void drawLeaderboard(Game1 cGame, GameTime gameTime, Master cScore, int CircleCount, int NeutralCount, int SquareCount, int maxEnemyNumber) { if (!doOnce) { gTimeSeconds = gameTime.TotalGameTime.TotalSeconds; gTimeMinutes = gameTime.TotalGameTime.TotalMinutes; countDownSecs = 60; countDownMins = cScore.GameTimeLeft - 1; doOnce = true; } if (gTimeSeconds + 1 < gameTime.TotalGameTime.TotalSeconds) { if (countDownSecs <= 0 && countDownMins >= 0) countDownSecs = 60; else if (countDownSecs > 0) countDownSecs--; gTimeSeconds = gameTime.TotalGameTime.TotalSeconds; } if (gTimeMinutes + 1 < gameTime.TotalGameTime.TotalMinutes) { countDownMins--; gTimeMinutes = gameTime.TotalGameTime.TotalMinutes; } cScore.GameTimeLeft = countDownMins; if (countDownMins < 10 && countDownSecs < 10) gameTimer = "Time Left: 0" + countDownMins + ":0" + countDownSecs; else if (countDownMins < 10) gameTimer = "Time Left: 0" + countDownMins + ":" + countDownSecs; else if (countDownSecs < 10) gameTimer = "Time Left: " + countDownMins + ":0" + countDownSecs; else gameTimer = "Time Left: " + countDownMins + ":" + countDownSecs; player1Score = "Square Score: " + cScore.returnScore[0]; player2Score = "Circle Score: " + cScore.returnScore[1]; //20 apart on y-axis //fuxk x axis cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); cGame.spriteBatch.DrawString(Arial, player1Score, new Vector2(5.0f, 5.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); cGame.spriteBatch.DrawString(Arial, player2Score, new Vector2(600.0f, 5.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); cGame.spriteBatch.DrawString(Arial, gameTimer, new Vector2(300.0f, 5.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); cGame.spriteBatch.Draw(CircleBar, new Rectangle(0, 550, 800 * CircleCount / maxEnemyNumber, 50), Color.White); cGame.spriteBatch.Draw(NeutralBar, new Rectangle(800 * CircleCount / maxEnemyNumber, 550, 800 * NeutralCount / maxEnemyNumber, 50), Color.White); cGame.spriteBatch.Draw(SquareBar, new Rectangle(800 * (CircleCount + NeutralCount) / maxEnemyNumber, 550, 800 * SquareCount / maxEnemyNumber, 50), Color.White); cGame.spriteBatch.End(); }
public void drawMenu(Game1 cGame, GameTime gameTime) { update(cGame, gameTime); cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied); cGame.spriteBatch.Draw(backgroundImg, new Vector2(0, 0), Color.White); cGame.spriteBatch.End(); cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied); if (menuSection == 0) { cGame.spriteBatch.Draw(HowToPlay, new Vector2(225, 325), itemColor[0]); cGame.spriteBatch.Draw(Start, new Vector2(325, 385), itemColor[1]); cGame.spriteBatch.Draw(Credits, new Vector2(325, 445), itemColor[2]); cGame.spriteBatch.Draw(Exit, new Vector2(325, 505), itemColor[3]); cGame.spriteBatch.End(); } else if (menuSection == 1) { cGame.spriteBatch.Draw(htpScreen, new Vector2(0, 0), Color.White); cGame.spriteBatch.End(); } else if (menuSection == 2) { cGame.spriteBatch.End(); cGame.spriteBatch.Begin(); cGame.spriteBatch.Draw(creditsScreen, new Rectangle(0, 0, 800, 600), new Rectangle(0, creditsY, 800, 600), Color.White); cGame.spriteBatch.End(); //cGame.spriteBatch.End(); //cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied); //cGame.spriteBatch.Draw(backgroundImg2, new Vector2(0, 0), Color.White); //cGame.spriteBatch.End(); //cGame.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); //cGame.spriteBatch.DrawString(Arial, "Credits ", new Vector2(325.0f, 100.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Programmers: ", new Vector2(125.0f, 225.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Brett Faulds", new Vector2(125.0f, 245.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Daniel Selnick", new Vector2(125.0f, 265.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Even Cheng", new Vector2(125.0f, 285.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Rj McKeenHan", new Vector2(125.0f, 305.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Artist: ", new Vector2(325.0f, 225.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Even Cheng", new Vector2(325.0f, 245.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.DrawString(Arial, "Brian Maralis", new Vector2(325.0f, 265.0f), new Color((byte)fontColor.R, (byte)fontColor.G, (byte)fontColor.B)); //cGame.spriteBatch.End(); } }
public Credits(Game1 cGame) { creditsScreen = cGame.Content.Load<Texture2D>("images/Credits"); backgroundImg = cGame.Content.Load<Texture2D>("images/background"); Arial = cGame.Content.Load<SpriteFont>("SpriteFont1"); }
// in LoadContent() public Menu(Game1 cGame) { Arial = cGame.Content.Load<SpriteFont>("SpriteFont1"); }
private void update(Game1 cGame, GameTime gameTime) { if (menuSection == 0) { if (Keyboard.GetState().IsKeyDown(Keys.Down) || GamePad.GetState(PlayerIndex.One).DPad.Down == ButtonState.Pressed) { if (curState != prevState) { curState = true; curSelection++; } prevState = curState; } else if (Keyboard.GetState().IsKeyDown(Keys.Up) || GamePad.GetState(PlayerIndex.One).DPad.Up == ButtonState.Pressed) { if (curState != prevState) { curState = true; curSelection--; } prevState = curState; } else if (Keyboard.GetState().IsKeyDown(Keys.Enter) || (GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed)) { if (curSelection == 1) { if (curState != prevState) { curState = true; menuSection = 1; } prevState = curState; } else if (curSelection == 2) { if (curState != prevState) { curState = true; gameStart = true; } prevState = curState; } else if (curSelection == 3) { if (curState != prevState) { curState = true; menuSection = 2; } prevState = curState; } else if (curSelection == 4) { if (curState != prevState) { curState = true; cGame.Exit(); } prevState = curState; } } else curState = false; if (curSelection > 4) curSelection = 0; else if (curSelection < 0) curSelection = 4; switch (curSelection) { case 0: itemColor[0] = Color.White; itemColor[1] = Color.White; itemColor[2] = Color.White; itemColor[3] = Color.White; break; case 1: itemColor[0] = Color.Turquoise; itemColor[1] = Color.White; itemColor[2] = Color.White; itemColor[3] = Color.White; break; case 2: itemColor[0] = Color.White; itemColor[1] = Color.Turquoise; itemColor[2] = Color.White; itemColor[3] = Color.White; break; case 3: itemColor[0] = Color.White; itemColor[1] = Color.White; itemColor[2] = Color.Turquoise; itemColor[3] = Color.White; break; case 4: itemColor[0] = Color.White; itemColor[1] = Color.White; itemColor[2] = Color.White; itemColor[3] = Color.Turquoise; break; } } else if (menuSection == 1) { if (Keyboard.GetState().IsKeyDown(Keys.Enter) || GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Space)) { if (curState != prevState) { curState = true; menuSection = 0; } prevState = curState; } else curState = false; } else if (menuSection == 2) { currentTime += gameTime.ElapsedGameTime.TotalSeconds; if (currentTime > 0.01) { creditsY++; currentTime -= 0.01; if (creditsY > 1300) { curState = true; menuSection = 0; creditsY = 0; } } if (Keyboard.GetState().IsKeyDown(Keys.Enter) || GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Space)) { if (curState != prevState) { curState = true; menuSection = 0; creditsY = 0; } prevState = curState; } else curState = false; } }
public void Draw(Game1 game, GameTime gameTime) { sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone, null, camera.transform); gBackground.drawThis(sb); circlePlayer.drawCollisionParticles(sb, gameTime); squarePlayer.drawCollisionParticles(sb, gameTime); sb.End(); sb.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied, SamplerState.AnisotropicClamp, DepthStencilState.DepthRead, RasterizerState.CullNone, null, camera.transform); border.Draw(sb); circlePlayer.Draw(sb); squarePlayer.Draw(sb); foreach (Enemy enemy in enemies) { enemy.Draw(sb); } sb.End(); gLeaderboard.drawLeaderboard(game, gameTime, this, CircleCount, NeutralCount, SquareCount, maxEnemyNumber); game.spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); //DrawContestBar(game.spriteBatch); game.spriteBatch.End(); }
public void InitializeSfx(Game1 cGame) { gSong = new BackgroundSong(cGame); gSoundfx = new SoundFx(cGame); gLeaderboard = new Leaderboard(cGame); gBackground = new GameBackground(cGame); }
public GameEnd(Game1 cGame) { backgroundImg = cGame.Content.Load<Texture2D>("images/round_over"); Arial = cGame.Content.Load<SpriteFont>("SpriteFont1"); }