Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Assembly v 2.4 (18.05.24)
Browse files Browse the repository at this point in the history
  • Loading branch information
adslbarxatov committed May 17, 2024
1 parent 42d75b8 commit 8ff169e
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# Константы, используемые далее по тексту
env:
PROJ: ${{ github.event.repository.name }}
TAG: '2.3.2'
TAG: '2.4'

steps:
# Проверка состава репозитория (без анализа, как может показаться)
Expand Down
Binary file added .release/Races.exe
Binary file not shown.
12 changes: 12 additions & 0 deletions .release/Races_en_us.dph
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
In this game you need to drive the entire track (12 levels), without colliding with other cars. For overtaking them, and also for diamonds caught on the road points will be awarded; they will be reduced for collisions. Each new level involves more speed and more cars to overtake. Good luck!

Controls:
[Space] – pause / resume / start game
[↑] – accelerator
[↓] – brake
[←], [→] – movement
[Esc] – exit the game
[S] – mute / unmute SFX
[M] – turn on / off the music
[L] – change the interface language
[F1] – show the help materials
12 changes: 12 additions & 0 deletions .release/Races_ru_ru.dph
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
В игре необходимо проехать всю трассу (12 уровней), не сталкиваясь с другими автомобилями. За их обгон, а также за пойманные на дороге бриллианты будут начисляться очки; за столкновения они будут сниматься. Каждый новый уровень предполагает бо́льшую скорость и большее число машин, которые нужно обогнать. Удачи!

Управление:
[Пробел] – пауза / возобновление / начало игры
[↑] – ускорение
[↓] – торможение
[←], [→] – движение по полосам
[Esc] – выход из игры
[S] – включение / выключение звуков
[M] – включение / выключение музыки
[L] – выбор языка интерфейса
[F1] – отображение справочных материалов
9 changes: 6 additions & 3 deletions .release/Release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
_Changes for v 2.3.2_:
- Update for XPUN has been applied;
- Core updates have been applied
_Changes for v 2.4_:
- The application has been retargeted to `.NET 8.0`;
- Some minor fixes have been applied;
- Access checking method has been completely rewritten: now it will properly detect problems with file / registry input / output and help user with fixing them;
- Added the special section in the user guide for access troubleshooting;
- Update for XPUN has been applied
7 changes: 7 additions & 0 deletions Changes.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Races minigame: changes log

Version 2.4:
• The application has been retargeted to .NET 8.0;
• Some minor fixes have been applied;
• Access checking method has been completely rewritten: now it will properly detect problems
with file / registry input / output and help user with fixing them;
• Added the special section in the user guide for access troubleshooting

Version 2.3.5:
• Updated HypeHelp and Updates checker mechanics: this should fix apps freezing immediately
after launch (on some PCs);
Expand Down
170 changes: 115 additions & 55 deletions src/RacesGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class RacesGame: Game
private SpriteBatch spriteBatch; // Sprite-отрисовка
private KeyboardState keyboardState; // Состояние клавиатуры
private SpriteFont defFont, midFont, bigFont; // Шрифты
private Random rnd = new Random (); // ГСЧ
/*private Random rnd = new Random (); // ГСЧ*/

/// <summary>
/// Ширина окна
Expand Down Expand Up @@ -52,55 +52,115 @@ public class RacesGame: Game
// Начальный статус игры (статусы перечислены в Auxilitary.cs)

// Описатели уровня и окна сообщений
private int levelNumber = 0, // Номер текущего уровня
carsLeft = 0, // Количество пройденных машин
currentSpeed = 3; // Скорость игрока
private const int levelsQuantity = 30; // Число уровней
private Texture2D back, // Фон игры
startBack; // Фон на старте
private Vector2 backOffset; // Смещение текстуры дороги

// Номер текущего уровня
private int levelNumber = 0;

// Количество пройденных машин
private int carsLeft = 0;

// Скорость игрока
private int currentSpeed = 3;

// Число уровней
private const int levelsQuantity = 30;

// Фон игры
private Texture2D back;

// Фон на старте
private Texture2D startBack;

// Смещение текстуры дороги
private Vector2 backOffset;

// Текущая позиция игрока и его объекты анимации
private Vector2 playerPosition; // Текущая позиция
private Animation playerAnimation, deadAnimation; // Изображения анимации (движется, dead)
private AnimationPlayer playerAnimator; // Объект-анимация

// Текущая позиция
private Vector2 playerPosition;

// Изображения анимации (движется, dead)
private Animation playerAnimation, deadAnimation;

// Объект-анимация
private AnimationPlayer playerAnimator;

// Машины, съедобные объекты и прочие параметры
private Texture2D[] carTextures, // Автомобили
bytheTextures; // Околодорожные объекты

// Автомобили
private Texture2D[] carTextures;

// Околодорожные объекты
private Texture2D[] bytheTextures;
private Animation eatable;
private AnimationPlayer eatableAnimator;
private CarState[,] carPosition = new CarState[LinesQuantity, 3];
private Vector2 bythePosition, // Позиция околодорожного объекта
eatablePosition; // Позиция съедобного объекта

// Позиция околодорожного объекта
private Vector2 bythePosition;

// Позиция съедобного объекта
private Vector2 eatablePosition;
private int bytheTextureNumber = 0, bytheShow = 0;

// Звуковые эффекты и их параметры
private SoundEffect SFailed, // Поражение
SStart, SStop, SOnOff, // Старт, пауза, звук off/on
SAte, // Съедение
CBrake, CEng, // Торможение / разгон
//SBythe, // Обгон
NewLev; // Новый уровень
private int soundDelay = 0; // Пауза между звуками CBrake, CEng и прочими
private bool isSound = true, isMusic = true; // Звук и музыка в игре on/off

// Поражение
private SoundEffect SFailed;

// Старт, пауза, звук off/on
private SoundEffect SStart, SStop, SOnOff;

// Съедение
private SoundEffect SAte;

// Торможение / разгон
private SoundEffect CBrake, CEng;

// Обгон
//private SoundEffect SBythe;

// Новый уровень
private SoundEffect NewLev;

// Пауза между звуками CBrake, CEng и прочими
private int soundDelay = 0;

// Звук и музыка в игре on/off
private bool isSound = true, isMusic = true;

// Параметры Alive и Working
private bool isAlive = false, isWorking = false;

// Очки
private int score = 0; // Выигрыш
private const int scoreMultiplier = 10; // Множитель для очков
private const int penalty = 99; // Штраф за проигрыш

// Выигрыш
private int score = 0;

// Множитель для очков
private const int scoreMultiplier = 10;

// Штраф за проигрыш
private const int penalty = 99;

// Флаги отображения сообщений
private bool showLoseMsg = false, // Сообщение о прохождении уровня
showExitMsg = false; // Подтверждение выхода

// Сообщение о прохождении уровня
private bool showLoseMsg = false;

// Подтверждение выхода
private bool showExitMsg = false;

// Согласователи клавиатуры
private int kbdDelay = 1, // Пауза в Update-итерациях перед следующим опросом клавиатуры
kbdDelayTimer; // Таймер для delay
private const int kbdDefDelay = 25; // Базовый delay при нажатии клавиши

// Пауза в Update-итерациях перед следующим опросом клавиатуры
private int kbdDelay = 1;

// Таймер для delay
private int kbdDelayTimer;

// Базовый delay при нажатии клавиши
private const int kbdDefDelay = 25;

/// <summary>
/// Конструктор. Формирует рабочую область и окно приложения
Expand Down Expand Up @@ -245,7 +305,7 @@ protected override void Update (GameTime VGameTime)
// Движение съедобного объекта
if (eatablePosition.Y + currentSpeed >= BackBufferHeight + eatable.FrameHeight)
{
eatablePosition.X = rnd.Next (RoadLeft + eatable.FrameWidth / 2,
eatablePosition.X = RDGenerics.RND.Next (RoadLeft + eatable.FrameWidth / 2,
RoadLeft + RoadLineWidth * LinesQuantity - eatable.FrameWidth / 2);
eatablePosition.Y = -BackBufferHeight;
}
Expand All @@ -255,10 +315,10 @@ protected override void Update (GameTime VGameTime)
// Движение околодорожного объекта
if (bythePosition.Y > BackBufferHeight + bytheTextures[bytheTextureNumber].Height)
{
bytheTextureNumber = rnd.Next (bytheTextures.Length);
bytheTextureNumber = RDGenerics.RND.Next (bytheTextures.Length);
bythePosition.X = (3 * RoadLeft / 2 - bytheTextures[bytheTextureNumber].Width) / 2;
bythePosition.Y = -bytheTextures[bytheTextureNumber].Height;
bytheShow = rnd.Next (2);
bytheShow = RDGenerics.RND.Next (2);
}
else
bythePosition.Y += currentSpeed;
Expand Down Expand Up @@ -288,19 +348,19 @@ protected override void Update (GameTime VGameTime)
for (int i = 0; i < carPosition.GetLength (0); i++)
{
score += carPosition[i, j].Enabled;
carPosition[i, j].Enabled = rnd.Next (2);
carPosition[i, j].Enabled = RDGenerics.RND.Next (2);
s += carPosition[i, j].Enabled;
carPosition[i, j].TextureNumber = rnd.Next (carTextures.Length);
carPosition[i, j].TextureNumber = RDGenerics.RND.Next (carTextures.Length);
carPosition[i, j].SetCurrentPosY (-BackBufferHeight);
}

if (levelNumber <= 12)
{
// Если (внезапно) восемь или семь машин окажутся активными
if (s > carPosition.GetLength (0) - 1)
carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 0;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 0;
if (s > carPosition.GetLength (0) - 2)
carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 0;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 0;
}
else if (levelNumber <= 17)
{
Expand All @@ -310,10 +370,10 @@ protected override void Update (GameTime VGameTime)
for (int i = 0; i < carPosition.GetLength (0); i++)
carPosition[i, j].Enabled = 0;

carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 1;
}
}
else if (levelNumber <= 22)
Expand All @@ -323,8 +383,8 @@ protected override void Update (GameTime VGameTime)
for (int i = 0; i < carPosition.GetLength (0); i++)
carPosition[i, j].Enabled = 0;

carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 1;
}
}
else if (levelNumber <= 28)
Expand All @@ -334,7 +394,7 @@ protected override void Update (GameTime VGameTime)
for (int i = 0; i < carPosition.GetLength (0); i++)
carPosition[i, j].Enabled = 0;

carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 1;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 1;
}
}
else
Expand Down Expand Up @@ -394,8 +454,8 @@ protected override void Update (GameTime VGameTime)
if (IsAte ())
{
// Удаление съеденного объекта
eatablePosition.X = rnd.Next (RoadLeft + eatable.FrameWidth / 2,
RoadLeft + RoadLineWidth * LinesQuantity - eatable.FrameWidth / 2);
eatablePosition.X = RDGenerics.RND.Next (RoadLeft + eatable.FrameWidth / 2,
RoadLeft + RoadLineWidth * LinesQuantity - eatable.FrameWidth / 2);
eatablePosition.Y = -back.Height;

// Пересчёт очков
Expand Down Expand Up @@ -642,8 +702,8 @@ private void KeyboardMoveProc ()
soundDelay++;
soundDelay %= 100;
if (soundDelay == 0)
CBrake.Play ((90 + rnd.Next (10)) * 0.01f,
(10 - rnd.Next (20)) * 0.01f, 0.0f);
CBrake.Play ((90 + RDGenerics.RND.Next (10)) * 0.01f,
(10 - RDGenerics.RND.Next (20)) * 0.01f, 0.0f);
}
}

Expand Down Expand Up @@ -1082,26 +1142,26 @@ private void GenerateLevelObjects ()
// Для одной полосы скорость всех машин одинакова
for (int i = 0; i < carPosition.GetLength (0); i++)
{
b = rnd.Next (2);
b = RDGenerics.RND.Next (2);
s += b;
carPosition[i, j] = new CarState (rnd.Next (carTextures.Length), i, j, b);
carPosition[i, j] = new CarState (RDGenerics.RND.Next (carTextures.Length), i, j, b);
}

// Если (внезапно) все восемь машин окажутся активными
if (s == carPosition.GetLength (0))
carPosition[rnd.Next (carPosition.GetLength (0)), j].Enabled = 0;
carPosition[RDGenerics.RND.Next (carPosition.GetLength (0)), j].Enabled = 0;
}

// Первый съедобный объект
eatablePosition.X = rnd.Next (RoadLeft + eatable.FrameWidth / 2,
eatablePosition.X = RDGenerics.RND.Next (RoadLeft + eatable.FrameWidth / 2,
RoadLeft + RoadLineWidth * LinesQuantity - eatable.FrameWidth / 2);
eatablePosition.Y = -BackBufferHeight;

// Первый околодорожный объект
bytheTextureNumber = rnd.Next (bytheTextures.Length);
bytheTextureNumber = RDGenerics.RND.Next (bytheTextures.Length);
bythePosition.X = (3 * RoadLeft / 2 - bytheTextures[bytheTextureNumber].Width) / 2;
bythePosition.Y = -bytheTextures[bytheTextureNumber].Height;
bytheShow = rnd.Next (2);
bytheShow = RDGenerics.RND.Next (2);
}
}
}
4 changes: 3 additions & 1 deletion src/RacesProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public static void Main (string[] args)
RDGenerics.ShowAbout (true);

// Контроль прав
bool _ = RDGenerics.IsRegistryAccessible;
/*bool _ = RDGenerics.IsRegistryAccessible;*/
if (!RDGenerics.AppHasAccessRights (true, true))
return;

// Выполнение проверки на наличие всех необходимых файлов
if (!RDGenerics.CheckLibraries (Pths, "Content\\" + ProgramDescription.AssemblyMainName +
Expand Down

0 comments on commit 8ff169e

Please sign in to comment.