Hugo Hu / Mbed 2 deprecated BRAVEHEART

Dependencies:   mbed N5110 ShiftReg PinDetect

Entity.h

Committer:
Siriagus
Date:
2015-05-08
Revision:
12:8178fad5e660
Parent:
11:adb68da98262
Child:
13:7ab71c7c311b

File content as of revision 12:8178fad5e660:

#ifndef ENTITY_H
#define ENTITY_H

/** An entity represents a movable character, such as the player, enemies etc.
*   Note that the entity class does not contain the sprite (image) of the entity.
*   Different sprites are given as 2D const int arrays in 
*   OBS! The entity's dimensions should be the same as the width and height or else this will lead to undefined behaviour!
*/
class Entity
{
    public:
        Entity() {x = y = width = height = vx = vy = 0; facingLeft = true; onGround = false;}
        Entity(int x, int y, int w, int h) : x(x), y(y), width(w), height(h) {vx = vy = 0; facingLeft = true; onGround = false;}
        
        int x, y;       /// Position of entity
        int vx, vy;     /// Velocity of entity
        int width;      /// Width of entity
        int height;     /// Height of entity
        
        bool facingLeft; /// True if the entity is facing left
        bool onGround;  /// True if entity is standing on the ground.
};

#endif