aboutsummaryrefslogtreecommitdiffstats
path: root/include/entities.hpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-04-13 08:47:41 -0400
committerClyne Sullivan <tullivan99@gmail.com>2016-04-13 08:47:41 -0400
commitfa4b6e00fd204998f6011420bdad60477b7a2f12 (patch)
tree4fd37e92f375ddb49e156b07811b8a2fe1ad6c0d /include/entities.hpp
parent03130c5bcec3c885a1be005c24e192dfb57f3fe5 (diff)
parentheses
Diffstat (limited to 'include/entities.hpp')
-rw-r--r--include/entities.hpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/entities.hpp b/include/entities.hpp
index 5ab4066..6cd5731 100644
--- a/include/entities.hpp
+++ b/include/entities.hpp
@@ -13,6 +13,7 @@
#define NPCp(n) ((NPC *)n)
#define Structurep(n) ((Structures *)n)
#define Mobp(n) ((Mob *)n)
+#define Objectp(n) ((Object *)n)
#define PLAYER_INV_SIZE 43 // The size of the player's inventory
#define NPC_INV_SIZE 3 // Size of an NPC's inventory
@@ -102,18 +103,18 @@ public:
glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x, loc.y + width);
glEnd();
}
- void update( float _gravity, float ground_y ) {
+ void update(float _gravity, float ground_y) {
// handle ground collision
- if ( loc.y < ground_y ) {
+ if (loc.y < ground_y) {
loc.y = ground_y;
- if ( bounce ) {
+ if (bounce) {
vel.y *= -0.2f;
vel.x /= 4;
} else {
vel.x = vel.y = 0;
canMove = false;
}
- } else if ( gravity && vel.y > -1 )
+ } else if (gravity && vel.y > -1)
vel.y -= _gravity * deltaTime;
}
bool kill(float delta){
@@ -188,6 +189,9 @@ public:
void follow(Entity *e);
+ bool isNear(Entity e);
+ bool isInside(vec2 coord) const;
+
virtual ~Entity(){}
};