51 if(self->mHealth <= 0)
66 }
else if(SDL_GameControllerGetButton(
gController, SDL_CONTROLLER_BUTTON_DPAD_LEFT))
69 }
else if(SDL_GameControllerGetButton(
gController, SDL_CONTROLLER_BUTTON_DPAD_RIGHT))
72 }
else if(SDL_GameControllerGetButton(
gController, SDL_CONTROLLER_BUTTON_B))
88 printf(
"You died, Game over. Start a new game");
95 printf(
"You died, select your powerups again \n");
105 if(!self->mData)
return;
108 if(!self->mData->mObjectCheck)
110 self->mData =
self->mData->mLink;
145 if(! (other->mHazards & self->mHazards) )
155 if(! (other->mHazards & self->mHazards) )
174 if(! (other->mHazards & self->mHazards) )
184 if(! (other->mHazards & self->mHazards) )
198 switch(other->mCollisionType)
209 void TouchGoal(entity_t*
self, entity_t* other,
int type)
221 printf(
"Couldn't alloc EntitySys");
224 if( (
gEntityDictionary = (entity_t*) malloc(
sizeof(entity_t)*MAX_ENTITIES)) == NULL )
226 printf(
"Couldn't alloc EntitySys");
229 memset(
gEntities, 0,
sizeof(entity_t)*MAX_ENTITIES);
241 printf(
"Entity system unintialiazeed");
374 x =
self->mPosition.x - other->mPosition.x;
375 y =
self->mPosition.y -
self->mPosition.y;
376 return powf(powf(x, 2) + powf(y, 2), (
float) 1/2);
399 memset(ent, 0,
sizeof(entity_t));
void TouchEnemy(entity_t *self, entity_t *other, int type)
int CountMem(void *src, int size_type)
entity_t * gEntityDictionary
unsigned int gCurrentTime
entity_t * InitNewEntity()
void TouchPlayer(entity_t *self, entity_t *other, int type)
void TouchGoal(entity_t *self, entity_t *other, int type)
void DrawGeneric(entity_t *self)
void FreeNonPlayerEntities()
entity_t * FindCachedEntity(const char *name)
SDL_GameController * gController
SDL_GameControllerButton gButtonQ
entity_t * FindEntity(const char *name)
#define HAZARD_STUN_FRAMES
char * EntityStates_str[]
entity_t * LookForEntityAtPos(vec2_t position)
void ThinkGeneric(entity_t *self)
void DoPlayerThink(void *player, SDL_GameControllerButton button)
void DrawPlayer(entity_t *self)
char ** gSelectedPowerUps
entity_t * FindFreeEntity(int *position)
void(*)(entity_t *) GetFunctionAI(ai_function_t *data)
int DrawSprite(sprite_t *sprite, int *frame, vec2_t *position, SDL_Renderer *renderer)
void FreeEntity(entity_t *ent)
void TouchGeneric(entity_t *self, entity_t *other, int type)
void ThinkEnemy(entity_t *self)
power_t * gCurrentPowerUp
entity_t * FindNextFreeCachePos()
void ShutdownEntitySystem()
void ThinkPlayer(entity_t *self)
int Distance2Entity(entity_t *self, entity_t *other)