Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Game/Game.cpp
- Revision:
- 24:7770c7f27cdc
- Parent:
- 23:5e8a435e568f
- Child:
- 25:1d3bf74dddeb
--- a/Game/Game.cpp Thu May 09 12:15:50 2019 +0000
+++ b/Game/Game.cpp Thu May 09 12:46:52 2019 +0000
@@ -14,7 +14,7 @@
{
// set character coordinates and health //
smiley.init(x, y);
- _lives = 10;
+ _health = 10;
// initialise all coin coordinates //
coin1.init(41, 42);
@@ -39,9 +39,9 @@
enemyC.init(1, 1);
}
-int Game::get_lives()
+int Game::get_health()
{
- return _lives;
+ return _health;
}
void Game::direc(Gamepad &pad)
@@ -53,7 +53,7 @@
{
// displays updating health value on screen //
char buffer[14];
- sprintf(buffer,"%d",_lives);
+ sprintf(buffer,"%d",_health);
lcd.printString(buffer,0,5);
}
@@ -141,7 +141,7 @@
enemyB.collidePlayer(x, y, pad) == true ||
enemy2.collidePlayer(x, y, pad) == true ||
enemyC.collidePlayer(x, y, pad) == true) {
- _lives--;
+ _health--;
wait(0.1);
}
}
@@ -149,7 +149,7 @@
void Game::death(N5110 &lcd)
{
// detects a loss and displays game over screen //
- if (_lives == 0) {
+ if (_health == 0) {
lcd.clear();
lcd.printString("PUT",30,1);
lcd.printString("ON",30,2);