Andreas Garmannslund / Mbed 2 deprecated SimplePlatformGame

Dependencies:   N5110 PinDetect PowerControl mbed

Embed: (wiki syntax)

« Back to documentation index

Entity Class Reference

Entity Class Reference

An entity represents a movable character, such as the player, enemies etc. More...

#include <Entity.h>

Inherited by Enemy.

Public Member Functions

int getRight ()
 Returns x-position of the right edge.
int getBottom ()
 Returns y-position of the bottom edge.

Data Fields

int x
 Position of entity (origin: left upper corner)
int vx
 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.
bool dead
 True if enemy is dead.

Detailed Description

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!

Definition at line 10 of file Entity.h.


Member Function Documentation

int getBottom (  )

Returns y-position of the bottom edge.

Definition at line 40 of file Entity.h.

int getRight (  )

Returns x-position of the right edge.

Definition at line 37 of file Entity.h.


Field Documentation

bool dead

True if enemy is dead.

Definition at line 34 of file Entity.h.

bool facingLeft

True if the entity is facing left.

Definition at line 29 of file Entity.h.

int height

Height of entity.

Definition at line 26 of file Entity.h.

bool onGround

True if entity is standing on the ground.

Definition at line 31 of file Entity.h.

int vx

Velocity of entity.

Definition at line 20 of file Entity.h.

int width

Width of entity.

Definition at line 23 of file Entity.h.

int x

Position of entity (origin: left upper corner)

Definition at line 17 of file Entity.h.