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 N5110 ShiftReg PinDetect
Diff: Entity.h
- Revision:
- 19:89c3eeb3761b
- Parent:
- 18:709ea375b0df
- Child:
- 20:32c8a82a1d4f
--- a/Entity.h Mon May 11 04:40:23 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -#ifndef ENTITY_H -#define ENTITY_H -/// @file 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; dead = false;} - Entity(int x, int y, int w = 0, int h = 0) : x(x), y(y), width(w), height(h) {vx = vy = 0; facingLeft = true; onGround = false; dead = false;} - - /// Position of entity (origin: left upper corner) - int x, y; - - /// Velocity of entity - int vx, vy; - - /// Width of entity - int width; - - /// Height of entity - int height; - - /// True if the entity is facing left - bool facingLeft; - /// True if entity is standing on the ground. - bool onGround; - - /// True if enemy is dead. - bool dead; - - /// Returns x-position of the right edge - int getRight() {return x + width - 1;} - - /// Returns y-position of the bottom edge - int getBottom() {return y + height - 1;} -}; - -#endif \ No newline at end of file