Предыдущая Следующая
{
if (keyboardState.IsKeyDown(Keys.Left))
platform.spritePosition.X -= 10; else if (keyboardState.IsKeyDown(Keys.Right))
platform.spritePosition.X += 10;
if (platform.spritePosition.X < 10)
platform.spritePosition.X = 10; else if(platform.spritePosition.X> Window.ClientBounds.Width - 400) platform.spritePosition.X = Window.ClientBounds.Width - 400;
}
/// <summary> /// Пауза в игре /// <summary> public void Pause()
{
if (keyboardState.IsKeyDown(Keys.P))
{
pauseKeyDown = true;
}
else if (pauseKeyDown)
{
pauseKeyDown = false; paused = Ipaused;
}
}
/// <summary>
/// Столкновения
/// <summary>
public void Collisions()
{
bbplatform.Min = new Vector3(platform.spritePosition.X, platform.spritePosition.Y + 25, 0);
bbplatform.Max = new Vector3(platform.spritePosition.X + platform.spriteTexture.Width, platform.spritePosition.Y + 25 + 2, 0);
for (int i = 0; bb.Length > i;
{
bb[i].Min = new Vector3(sprite[i].spritePosition.X, sprite[i].spritePosition.Y, 0);
bb[i].Max = new Vector3(sprite[i].spritePosition.X + sprite[i].spriteTexture.Width / 12,
sprite[i].spritePosition.Y + sprite[i].spriteTexture.Height, 0);
}
if (bbplatform.Intersects(bb[0]))
{
sprite[0].spritePosition = new Vector2(rand.Next(10, Window.ClientBounds.Width -
300 - sprite[0].spriteTexture.Width / 12), -500); sprite[0].speedSprite.Y = rand.Next(6, 10); totalScore += scoreO;
Sound.PlayCue(soundList.Platform);
}
if (bbplatform.Intersects(bb[1]))
{
sprite[1].spritePosition = new Vector2(rand.Next(10, Window.ClientBounds.Width -
300 - sprite[1].spriteTexture.Width / 12), -500); sprite[1].speedSprite.Y = rand.Next(6, 10); totalScore += scorel;
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(6, 10); totalScore += score2;
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(6, 10); totalScore += score3;
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(6, 10);
230 Добавляем в игру новые уровни Предыдущая Следующая
|