Предыдущая Следующая
Проект NewLevels 231
totalScore += score4;
Sound.PlayCue(soundList.Platform);
} }
/// <summary> /// Новая игра /// <summary>
public void NewGame(int curentLevel)
{
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);
switch (curentLevel) {
case 1:
scoreO = 5;
scorel = -20;
score2 = 5;
score3 = -2O;
score4 = 5;
totalScore = O;
endScore = 3OO; break;
case 2:
scoreO = 1O;
score1 = -2O;
score2 = 5;
score3 = -2O;
score4 = 5;
totalScore = O;
endScore = 600; break;
case 3:
scoreO = 10;
scorel = -30;
score2 = 5;
score3 = -30;
score4 = 8;
totalScore = 0;
endScore = 800; break;
case 4:
score0 = 10;
score1 = -30; score2 = 5; score3 = -30; score4 = 8; totalScore = 0; endScore = 900; break;
case 5:
score0 = 10;
score1 = -30;
score2 = 5;
score3 = -40;
score4 = 8;
totalScore = 0;
endScore = 1000; break;
case 6:
score0 = 10;
score1 = -40;
score2 = 5;
score3 = -50;
score4 = 8;
totalScore = 0;
endScore = 1100; break;
case 7:
score0 = 15;
score1 = -60;
score2 = 8;
score3 = -80;
score4 = 10;
totalScore = 0;
endScore = 1200; break;
case 8:
score0 = 20;
score1 = -100;
score2 = 8;
score3 = -100;
score4 = 10;
totalScore = 0;
endScore = 1300; break;
}
}
/// <summary>
/// Обновляем состояние мыши
/// <summary>
public void UpdateMouse()
232 Добавляем в игру новые уровни
Проект NewLevels 233
}
// Получаем местонахождения курсора мыши mouseState = Mouse.GetState(); mouse.spritePosition.X = mouseState.X; mouse.spritePosition.Y = mouseState.Y;
// Создаем ограничивающие прямоугольники для курсора и табличек bbMouse.Min = new Vector3(mouse.spritePosition.X, mouse.spritePosition.Y, 0);
bbMouse.Max = new Vector3(mouse.spritePosition.X + mouse.spriteTexture.Width,
mouse.spritePosition.Y + mouse.spriteTexture.Height, 0);
bbCursorGame.Min = new Vector3(650, 400, 0); bbCursorGame.Max = new Vector3(950, 500, 0);
bbCursorExit.Min = new Vector3(650, 600, 0); bbCursorExit.Max = new Vector3(950, 700, 0);
// Обрабатываем пересечение прямоугольников
if (bbMouse.Intersects(bbCursorGame))
{
menu.cursorPositionGame = new Vector2(650, 400); menu.cursorPositionExit = new Vector2(700, 550); cursorState = 1;
}
if (bbMouse.Intersects(bbCursorExit))
{
menu.cursorPositionGame = new Vector2(700, 400); menu.cursorPositionExit = new Vector2(650, 550); cursorState = 2; Предыдущая Следующая
|