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/Health/Health.cpp@29:6b8411bb040a, 2019-05-04 (annotated)
- Committer:
- el17sm
- Date:
- Sat May 04 15:39:20 2019 +0000
- Revision:
- 29:6b8411bb040a
- Parent:
- 28:98848e6a77a2
added Room complete;; started Floor engine;; ; To do:; Floor generation;; More enemies;; Bosses;; Title Screen;; Score;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el17sm | 28:98848e6a77a2 | 1 | #include "Health.h" |
| el17sm | 28:98848e6a77a2 | 2 | |
| el17sm | 28:98848e6a77a2 | 3 | Health::Health(float pos_x, float pos_y) |
| el17sm | 28:98848e6a77a2 | 4 | { |
| el17sm | 28:98848e6a77a2 | 5 | _damage_self_upon_collision = true; |
| el17sm | 28:98848e6a77a2 | 6 | _hp_drop_chance = 0; // out of 10 |
| el17sm | 28:98848e6a77a2 | 7 | moving = true; |
| el17sm | 28:98848e6a77a2 | 8 | face = 0; |
| el17sm | 28:98848e6a77a2 | 9 | hp = 1; |
| el17sm | 28:98848e6a77a2 | 10 | attack = -1; |
| el17sm | 28:98848e6a77a2 | 11 | hitbox.width = 7; |
| el17sm | 28:98848e6a77a2 | 12 | hitbox.height = 7; |
| el17sm | 28:98848e6a77a2 | 13 | position.x = pos_x; |
| el17sm | 28:98848e6a77a2 | 14 | position.y = pos_y; |
| el17sm | 28:98848e6a77a2 | 15 | sprite_size.width = 7; |
| el17sm | 28:98848e6a77a2 | 16 | sprite_size.height = 7; |
| el17sm | 28:98848e6a77a2 | 17 | sprite_size.offset_x = 0; |
| el17sm | 28:98848e6a77a2 | 18 | sprite_size.offset_y = 0; |
| el17sm | 28:98848e6a77a2 | 19 | } |
| el17sm | 28:98848e6a77a2 | 20 | |
| el17sm | 29:6b8411bb040a | 21 | void Health::move(float unused, float unused1, int * unused2, bool * unused3) |
| el17sm | 28:98848e6a77a2 | 22 | { |
| el17sm | 28:98848e6a77a2 | 23 | |
| el17sm | 28:98848e6a77a2 | 24 | } |
| el17sm | 28:98848e6a77a2 | 25 | |
| el17sm | 28:98848e6a77a2 | 26 | int * Health::get_frame() |
| el17sm | 28:98848e6a77a2 | 27 | { |
| el17sm | 28:98848e6a77a2 | 28 | return (int *) health_sprite; |
| el17sm | 28:98848e6a77a2 | 29 | } |
| el17sm | 28:98848e6a77a2 | 30 | |
| el17sm | 28:98848e6a77a2 | 31 | void Health::take_damage(int damage) |
| el17sm | 28:98848e6a77a2 | 32 | { |
| el17sm | 28:98848e6a77a2 | 33 | hp -= damage; |
| el17sm | 28:98848e6a77a2 | 34 | } |