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.
Diff: Hero/Hero.cpp
- Revision:
- 8:d1c04f0e4890
- Parent:
- 7:08f78909dda7
- Child:
- 9:3a0194c87afe
--- a/Hero/Hero.cpp Thu May 09 01:30:57 2019 +0000
+++ b/Hero/Hero.cpp Sat May 11 08:23:54 2019 +0000
@@ -12,20 +12,19 @@
// _health_rate = 50; possible addition
}
-bool Hero::health(bool collision, Gamepad &pad) {
+void Hero::health(bool collision, Gamepad &pad) {
// frame_counter++;
if (collision == true) {
_health--;
pad.tone(1500, 0.2);
}
- // if ( (frame_counter <= _health_rate) && (health < 4) ) { // increase health over time
- if (_health <= 0) {
- return false;
- } else {
- return true;
- }
+ // if ( (frame_counter <= _health_rate) && (health < 4) ) { _health++;} // increase health over time
}
void Hero::draw(N5110 &lcd) {
- lcd.drawCircle(_x,_y,5,FILL_TRANSPARENT);
+ lcd.drawCircle( _x, _y, 5, FILL_TRANSPARENT);
}
+
+int Hero::get_health() {
+ return _health;
+}