diff options
Diffstat (limited to 'src/entity.c')
| -rw-r--r-- | src/entity.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/entity.c b/src/entity.c index 4a7d98f..d737ea9 100644 --- a/src/entity.c +++ b/src/entity.c @@ -4,6 +4,7 @@ #include "game.h" #include "entity.h" //Entities +#include "wall.h" #include "player.h" extern struct game game; @@ -65,7 +66,7 @@ Rectangle animation_get_source_rect(const struct animation* animation) { return animation->source_rects[animation->current_frame]; } -void draw_entity(const struct entity* entity) { +void draw_entity_default(const struct entity* entity) { if (entity_animated(entity)) { const struct animation* current_animation = &entity->animations[entity->current_animation]; @@ -86,6 +87,18 @@ void draw_entity(const struct entity* entity) { } } +void draw_entity(const struct entity* entity) { + switch (entity->type) { + case Wall_Entity: + draw_wall(entity); + break; + + default: + draw_entity_default(entity); + break; + } +} + void add_entity(const struct entity* e) { static int entity_id = 0; @@ -101,5 +114,12 @@ void add_entity(const struct entity* e) { } void update_entity(struct entity* entity, float dt) { - update_player(entity, dt); + switch (entity->type) { + case Player_Entity: + update_player(entity, dt); + break; + + default: + break; + } } |
