Steven Mahasin / Mbed 2 deprecated DreamDungeon

Dependencies:   mbed MotionSensor

Entity/Collectibles/Health/Health.cpp

Committer:
el17sm
Date:
2019-05-06
Revision:
32:fe6359ef9916
Child:
33:4f3948dcd2f7

File content as of revision 32:fe6359ef9916:

#include "Health.h"

Health::Health(float pos_x, float pos_y)
{
    _damage_self_upon_collision = true;
    _hp_drop_chance = 0; // out of 10
    moving = true;
    face = 0;
    hp = 1;
    attack = -1;
    hitbox.width = 7;
    hitbox.height = 7;
    position.x = pos_x;
    position.y = pos_y;
    sprite_size.width = 7;
    sprite_size.height = 7;
    sprite_size.offset_x = 0;
    sprite_size.offset_y = 0;
}

void Health::move(float unused, float unused1, int * unused2, bool * unused3)
{
    
}

void Health::draw(N5110 &lcd)
{
    lcd.drawSpriteTransparent(position.x-sprite_size.offset_x,
                              position.y-sprite_size.offset_y,
                              sprite_size.height,
                              sprite_size.width,
                              get_frame());
}

int * Health::get_frame()
{
    return (int *) health_sprite;
}

void Health::take_damage(int damage)
{
    hp -= damage;
}