Предыдущая Следующая
300 - sprite[1].spriteTexture.Width / 12), -500); sprite[1].speedSprite.Y = rand.Next(5, 9); score1 += 1;
Sound.PlayCue(soundList.Platform);
}
if (bbplatform.Intersects(bb[2]))
{
sprite[2].spritePosition = new Vector2(rand.Next(10, Window.ClientBounds.Width -
300 - sprite[2].spriteTexture.Width / 12), -500); sprite[2].speedSprite.Y = rand.Next(5, 9); score2 += 1;
Sound.PlayCue(soundList.Platform);
}
if (bbplatform.Intersects(bb[3]))
{
sprite[3].spritePosition = new Vector2(rand.Next(10, Window.ClientBounds.Width -
300 - sprite[3].spriteTexture.Width / 12), -500); sprite[3].speedSprite.Y = rand.Next(5, 9);
score3 += 1;
Sound.PlayCue(soundList.Platform);
}
if (bbplatform.Intersects(bb[4]))
{
sprite[4].spritePosition = new Vector2(rand.Next(10, Window.ClientBounds.Width -
300 - sprite[4].spriteTexture.Width / 12), -500); sprite[4].speedSprite.Y = rand.Next(5, 9); score4 += 1;
Sound.PlayCue(soundList.Platform);
}
}
/// <summary>
/// Новая игра
/// <summary>
public void NewGame()
{
j = 0;
for (int i = 0; sprite.Length > i;
{
sprite[i].spritePosition = new Vector2(rand.Next(10, Window.ClientBounds.Width - 500), j = j - 300);
}
platform.spritePosition = new Vector2(Window.ClientBounds.Width/ 2,
Window.ClientBounds.Height - 90);
score0 = 0;
score1 = 0;
score2 = 0;
score3 = 0;
score4 = 0;
base.Initialize();
}
/// <summary>
/// Обновляем состояние мыши
/// <summary>
public void UpdateMouse()
{ }
/// <summary>
/// Рисуем на экране
/// <summary>
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue); if (menuState == true)
{
spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
212 Звуковые эффекты
Цикличное воспроизведение музыки 213
menu.DrawMenu(spriteBatch, cursorState);
mouse.DrawSprite(spriteBatch);
spriteBatch.End();
}
else
{
spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
spriteBatch.Draw(background1, new Vector2(0, 0), Color.White); for (int i = 0; sprite.Length > i;
{
sprite[i].DrawAnimationSprite(spriteBatch);
}
spriteBatch.Draw(background2, new Vector2(0, 0), Color.White);
platform.DrawSprite(spriteBatch);
spriteBatch.End();
if (paused == true)
{
font.DrawString(450, 300, Color.Black, "Пауза");
int fy = 245;
font.DrawString(Window.ClientBounds.Width - 95, fy, Color.Black,
"{0}", score0);
font.DrawString(Window.ClientBounds.Width-95, fy += font.LineHeight + 12, "{0}", score1); font.DrawString(Window.ClientBounds.Width-95, fy += font.LineHeight + 12, "{0}", score2); font.DrawString(Window.ClientBounds.Width-95, fy += font.LineHeight + 12, "{0}", score3); font.DrawString(Window.ClientBounds.Width-95, fy += font.LineHeight + 12, "{0}", score4); Предыдущая Следующая
|