Skip to content

Game with enemy ships, including a powerful large ship, utilizing multi-threading for enemy generation, bullet firing, and collision detection

Notifications You must be signed in to change notification settings

danil614/war-threads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WarThreadsGUI

C# .Net

Description

This repository contains a GUI application developed in C# WinForms for a simple war-themed game. The game features various functionalities including the appearance of a large ship with significant life points (5% chance of appearance) and three types of enemies with different movement speeds.

Upon initialization, a cannon PictureBox object is created.

image

The InitializeGame method initiates threads for enemy generation and speed incrementation over time.

image

The GenerateEnemies method utilizes an event, waiting for 15 seconds for the user to press the left or right arrow keys. Subsequently, a separate thread is created for each enemy.

image

In the CreateEnemy method, a 5% chance is implemented for the appearance of a large ship (enemy).

image

Collision detection between enemies and bullets is also implemented here.

image

When a collision occurs, the enemy's life points are decremented, and if it reaches zero, the enemy is removed.

The HandleHit method utilizes thread-safe incrementation to count the number of hits.

image

A semaphore is employed in the FireBullet method to limit the number of bullets, and it is released upon bullet deletion.

image image

The game concludes when the player reaches a certain number of misses.

Screenshots of the game

The start window

image

Running game

image image

A large ship appeared

image

Loss

image

About

Game with enemy ships, including a powerful large ship, utilizing multi-threading for enemy generation, bullet firing, and collision detection

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages