A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.
Dependencies: mbed MotionSensor
Health.cpp
00001 #include "Health.h" 00002 00003 Health::Health(float pos_x, float pos_y) 00004 { 00005 _hp = 1; 00006 _attack = -1; 00007 00008 _hitbox.width = 7; 00009 _hitbox.height = 7; 00010 00011 _position.x = pos_x; 00012 _position.y = pos_y; 00013 00014 _sprite_size.width = 7; 00015 _sprite_size.height = 7; 00016 _sprite_size.offset_x = 0; 00017 _sprite_size.offset_y = 0; 00018 } 00019 00020 void Health::move(float unused, float unused1, char * unused2, bool * unused3) // Health doesnt move, only typed out since the virtual function is pure 00021 { 00022 00023 } 00024 00025 void Health::draw(N5110 &lcd) 00026 { 00027 lcd.drawSpriteTransparent(_position.x+_sprite_size.offset_x, 00028 _position.y+_sprite_size.offset_y, 00029 _sprite_size.height, 00030 _sprite_size.width, 00031 (char *) health_sprite); 00032 } 00033 00034 void Health::take_damage(int damage) 00035 { 00036 _hp -= damage; 00037 }
Generated on Tue Jul 19 2022 23:32:07 by 1.7.2