public override void Draw(GameTime gametime, SpriteBatch spritebatch) { spritebatch.Begin(); spritebatch.Draw(background, new Vector2(0, 0), Color.White); foreach (var component in components) { component.Draw(spritebatch); } coinsAndHeartsManager.Draw(spritebatch, _content); spritebatch.End(); }
public override void Draw(GameTime gametime, SpriteBatch spritebatch) { spritebatch.Begin(); spritebatch.Draw(background, new Vector2(0, 0), Color.White); spritebatch.Draw(noteTexture, new Vector2(150, 200), Color.White); spritebatch.Draw(noteTexture, new Vector2(450, 200), Color.White); foreach (var component in _components) { component.Draw(spritebatch); } spritebatch.DrawString(btnTextFont, findThePassCtfButtonStr, new Vector2(200, 300), Color.Black); spritebatch.DrawString(btnTextFont, otherCtfButtonStr, new Vector2(500, 300), Color.Black); coinsAndHeartsManager.Draw(spritebatch, _content); spritebatch.End(); }
public override void Draw(GameTime gametime, SpriteBatch spritebatch) { //draw static backgound spritebatch.Begin(); spritebatch.Draw(background, new Vector2(0, 0), Color.White); coinsAndHeartsManager.Draw(spritebatch, _content); spritebatch.DrawString(font, time.ToString(), new Vector2(600, 5), Color.Black, 0f, new Vector2(0, 0), 2f, SpriteEffects.None, 0f); spritebatch.End(); //draw game spritebatch.Begin(transformMatrix: camera.transform); foreach (Platform platform in platforms) { platform.Draw(spritebatch); } foreach (DrawablObject d in objects) { d.Draw(spritebatch); } foreach (Bomb bomb in bombsList) { bomb.Draw(spritebatch); } foreach (Coin coin in coins) { coin.Draw(spritebatch); } foreach (Enemy enemy in enemies) { enemy.Draw(spritebatch); drawRectangle(spritebatch, enemy.rectangle, _content); } star.Draw(spritebatch); hero.Draw(spritebatch); drawRectangle(spritebatch, hero.rectangle, _content); spritebatch.End(); }
public override void Draw(GameTime gametime, SpriteBatch spritebatch) { if (isWaiting == 2) { Thread.Sleep(3000); isWaiting = 0; } spritebatch.Begin(); spritebatch.Draw(background, new Vector2(0, 0), Color.White); foreach (var component in _components) { component.Draw(spritebatch); } coinsAndHeartsManager.Draw(spritebatch, _content); if (isWaiting == 1) { spritebatch.Draw(notEnoughMoneyError, new Vector2(200, 100), Color.White); isWaiting = 2; } spritebatch.End(); }
public override void Draw(GameTime gametime, SpriteBatch spritebatch) { //if the animation of the slot machine is off spritebatch.Begin(); spritebatch.Draw(background, new Vector2(0, 0), Color.White); spritebatch.Draw(smTexture, new Vector2(300, 200), Color.White); spritebatch.Draw(txtr3[0], new Vector2(320, 240), Color.White); spritebatch.Draw(txtr3[1], new Vector2(420, 240), Color.White); spritebatch.Draw(txtr3[2], new Vector2(520, 240), Color.White); spritebatch.Draw(insTexture, new Vector2(15, 100), Color.White); foreach (var component in components) { component.Draw(spritebatch); } coinsAndHeartsManager.Draw(spritebatch, _content); spritebatch.End(); //handle animation if (isAnimation == true) { DateTime date = Load(); DateTime curr = DateTime.UtcNow; Random rand = new Random(); if (date.Day == curr.Day && date.Month == curr.Month && date.Year == curr.Year) { if (numOfChanges == 0) { handleErrorMsg(spritebatch, gametime); } else { Thread.Sleep(4000);//sleep isAnimation = false; } } else { if (numOfChanges == 0) { txtr3 = new List <Texture2D> { smTextures[0], smTextures[0], smTextures[0] } } ; if (numOfChanges < 20) { Thread.Sleep(200);//sleep int num1 = rand.Next(0, 8); int num2 = rand.Next(0, 8); int num3 = rand.Next(0, 8); txtr3 = new List <Texture2D> { smTextures[num1], smTextures[num2], smTextures[num3] }; } else if (numOfChanges == 20) { //update prize if (txtr3[0] == txtr3[1] && txtr3[0] == txtr3[2]) { coinsAndHeartsManager.Update(new CoinsAndHearts(1, 0, 0, 0)); CoinsAndHeartsManager.Save(coinsAndHeartsManager); spritebatch.Begin(); spritebatch.Draw(wonMsgs[0], new Vector2(270, 50), Color.White); spritebatch.End(); } else if (txtr3[0] == txtr3[1] || txtr3[0] == txtr3[2] || txtr3[2] == txtr3[1]) { coinsAndHeartsManager.Update(new CoinsAndHearts(0, 5, 0, 0)); CoinsAndHeartsManager.Save(coinsAndHeartsManager); spritebatch.Begin(); spritebatch.Draw(wonMsgs[1], new Vector2(270, 50), Color.White); spritebatch.End(); } else { coinsAndHeartsManager.Update(new CoinsAndHearts(0, 0, 10, 0)); CoinsAndHeartsManager.Save(coinsAndHeartsManager); spritebatch.Begin(); spritebatch.Draw(wonMsgs[2], new Vector2(270, 50), Color.White); spritebatch.End(); } } else { Thread.Sleep(4000);//sleep Save(curr); isAnimation = false; } } numOfChanges++; } }