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@38:09832e662803, 2019-05-07 (annotated)
- Committer:
- el17sm
- Date:
- Tue May 07 09:09:38 2019 +0000
- Revision:
- 38:09832e662803
- Parent:
- 37:a404860171a9
Attempted creation of mob Cowboy
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 | 38:09832e662803 | 5 | _type = 10; |
| el17sm | 32:fe6359ef9916 | 6 | hp = 1; |
| el17sm | 32:fe6359ef9916 | 7 | attack = -1; |
| el17sm | 37:a404860171a9 | 8 | |
| el17sm | 32:fe6359ef9916 | 9 | hitbox.width = 7; |
| el17sm | 32:fe6359ef9916 | 10 | hitbox.height = 7; |
| el17sm | 37:a404860171a9 | 11 | |
| el17sm | 32:fe6359ef9916 | 12 | position.x = pos_x; |
| el17sm | 32:fe6359ef9916 | 13 | position.y = pos_y; |
| el17sm | 37:a404860171a9 | 14 | |
| el17sm | 32:fe6359ef9916 | 15 | sprite_size.width = 7; |
| el17sm | 32:fe6359ef9916 | 16 | sprite_size.height = 7; |
| el17sm | 32:fe6359ef9916 | 17 | sprite_size.offset_x = 0; |
| el17sm | 32:fe6359ef9916 | 18 | sprite_size.offset_y = 0; |
| el17sm | 32:fe6359ef9916 | 19 | } |
| el17sm | 32:fe6359ef9916 | 20 | |
| el17sm | 34:1d5b4da3935e | 21 | void Health::move(float unused, float unused1, char * unused2, bool * unused3) |
| el17sm | 32:fe6359ef9916 | 22 | { |
| el17sm | 32:fe6359ef9916 | 23 | |
| el17sm | 32:fe6359ef9916 | 24 | } |
| el17sm | 32:fe6359ef9916 | 25 | |
| el17sm | 32:fe6359ef9916 | 26 | void Health::draw(N5110 &lcd) |
| el17sm | 32:fe6359ef9916 | 27 | { |
| el17sm | 35:06cd6be999ad | 28 | lcd.drawSpriteTransparent(position.x+sprite_size.offset_x, |
| el17sm | 35:06cd6be999ad | 29 | position.y+sprite_size.offset_y, |
| el17sm | 32:fe6359ef9916 | 30 | sprite_size.height, |
| el17sm | 32:fe6359ef9916 | 31 | sprite_size.width, |
| el17sm | 37:a404860171a9 | 32 | (char *) health_sprite); |
| el17sm | 32:fe6359ef9916 | 33 | } |
| el17sm | 32:fe6359ef9916 | 34 | |
| el17sm | 32:fe6359ef9916 | 35 | void Health::take_damage(int damage) |
| el17sm | 32:fe6359ef9916 | 36 | { |
| el17sm | 32:fe6359ef9916 | 37 | hp -= damage; |
| el17sm | 32:fe6359ef9916 | 38 | } |