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 MotionSensor
Entity/Collectibles/Health/Health.cpp@56:ef9521b7ed78, 2019-05-09 (annotated)
- Committer:
- el17sm
- Date:
- Thu May 09 08:42:52 2019 +0000
- Revision:
- 56:ef9521b7ed78
- Parent:
- 37:a404860171a9
- Child:
- 57:1c12361b6e3d
Full code in-line commented
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el17sm | 32:fe6359ef9916 | 1 | #include "Health.h" |
| el17sm | 32:fe6359ef9916 | 2 | |
| el17sm | 32:fe6359ef9916 | 3 | Health::Health(float pos_x, float pos_y) |
| el17sm | 32:fe6359ef9916 | 4 | { |
| el17sm | 32:fe6359ef9916 | 5 | hp = 1; |
| el17sm | 32:fe6359ef9916 | 6 | attack = -1; |
| el17sm | 37:a404860171a9 | 7 | |
| el17sm | 32:fe6359ef9916 | 8 | hitbox.width = 7; |
| el17sm | 32:fe6359ef9916 | 9 | hitbox.height = 7; |
| el17sm | 37:a404860171a9 | 10 | |
| el17sm | 32:fe6359ef9916 | 11 | position.x = pos_x; |
| el17sm | 32:fe6359ef9916 | 12 | position.y = pos_y; |
| el17sm | 37:a404860171a9 | 13 | |
| el17sm | 32:fe6359ef9916 | 14 | sprite_size.width = 7; |
| el17sm | 32:fe6359ef9916 | 15 | sprite_size.height = 7; |
| el17sm | 32:fe6359ef9916 | 16 | sprite_size.offset_x = 0; |
| el17sm | 32:fe6359ef9916 | 17 | sprite_size.offset_y = 0; |
| el17sm | 32:fe6359ef9916 | 18 | } |
| el17sm | 32:fe6359ef9916 | 19 | |
| el17sm | 56:ef9521b7ed78 | 20 | void Health::move(float unused, float unused1, char * unused2, bool * unused3) // Health doesnt move, only typed out since the virtual function is pure |
| el17sm | 32:fe6359ef9916 | 21 | { |
| el17sm | 32:fe6359ef9916 | 22 | |
| el17sm | 32:fe6359ef9916 | 23 | } |
| el17sm | 32:fe6359ef9916 | 24 | |
| el17sm | 32:fe6359ef9916 | 25 | void Health::draw(N5110 &lcd) |
| el17sm | 32:fe6359ef9916 | 26 | { |
| el17sm | 35:06cd6be999ad | 27 | lcd.drawSpriteTransparent(position.x+sprite_size.offset_x, |
| el17sm | 35:06cd6be999ad | 28 | position.y+sprite_size.offset_y, |
| el17sm | 32:fe6359ef9916 | 29 | sprite_size.height, |
| el17sm | 32:fe6359ef9916 | 30 | sprite_size.width, |
| el17sm | 37:a404860171a9 | 31 | (char *) health_sprite); |
| el17sm | 32:fe6359ef9916 | 32 | } |
| el17sm | 32:fe6359ef9916 | 33 | |
| el17sm | 32:fe6359ef9916 | 34 | void Health::take_damage(int damage) |
| el17sm | 32:fe6359ef9916 | 35 | { |
| el17sm | 32:fe6359ef9916 | 36 | hp -= damage; |
| el17sm | 32:fe6359ef9916 | 37 | } |