Skip to content

Create Health, Timer, Start game, End game function#3

Merged
AmberPotion merged 3 commits intothoth-tech:mainfrom
lexlam1524:health-timer-start-end
Oct 1, 2024
Merged

Create Health, Timer, Start game, End game function#3
AmberPotion merged 3 commits intothoth-tech:mainfrom
lexlam1524:health-timer-start-end

Conversation

@lexlam1524
Copy link

@lexlam1524 lexlam1524 commented Sep 18, 2024

BeeFall.2024-09-18.22-04-19.mp4

Description

Player Health System:
Implemented a health system with get_HP() and set_HP() functions within the Player class.
The player's health decreases when a collision with an obstacle is detected.
The game ends when the player's health reaches zero.

Timer Feature:
A timer was added to track game time using create_timer() and update_timer().
Time is displayed on the screen during the game.
The timer is reset when the game starts and pauses upon game over.

Game Start and End Functions:
A start screen is shown, and the game starts when the player presses the space bar (start_game() function).
A game over screen appears when the player’s health drops to zero.
The game can be restarted by pressing the space bar again after game over (check_game_over() function).

Rendering Updates:
Added scaling for the player bitmap and debug visualizations using bitmap_cell_circle() to detect collisions.
Obstacles are cleared when the game ends, and the player’s health is reset when the game restarts.

Type of change

Code

How Has This Been Tested?

Compiled and ran with
skm g++ program.cpp player.cpp obstacle.cpp bullet_factory.cpp -o game.exe

Checklist

My code follows the style guidelines of this project
I have performed a self-review of my own code
I have commented my code in hard-to-understand areas
I have made corresponding changes to the documentation
My changes generate no new warnings
I have requested a review from team members on the Pull Request

@AmberPotion AmberPotion merged commit 24fb3f2 into thoth-tech:main Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants