From dad2425e2c686f188c2d8e9e58ac62d87d073bde Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sun, 16 Oct 2016 13:33:26 -0400 Subject: prototyped new detect --- include/components.hpp | 14 ++++++++++++++ include/world.hpp | 22 +++++----------------- 2 files changed, 19 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/components.hpp b/include/components.hpp index 34a1906..5a638de 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -59,6 +59,20 @@ struct Physics { float g; /**< The gravity constant, how fast the object falls */ }; +/** + * @struct Health + * @brief Gives and entity health and stuff. + */ +struct Health { + /** + * Constructor that sets the variables, with 0 health as default. + */ + Health(int h = 0, int m = 0) : health(h), maxHealth(m) {} + + int health; + int maxHealth; +}; + /** * @struct Solid * @brief Allows an entity to collide with other objects. diff --git a/include/world.hpp b/include/world.hpp index a99affa..a574401 100644 --- a/include/world.hpp +++ b/include/world.hpp @@ -175,6 +175,11 @@ public: { return weather; } void setWeather(const std::string &s); + + void singleDetect(Entity *e, entityx::TimeDelta dt); + void detect(entityx::TimeDelta dt); + + void detect2(entityx::TimeDelta dt); }; @@ -253,11 +258,6 @@ public: std::vector entityPending; - /** - * Handles death, gravity, etc. for a single entity - */ - virtual void singleDetect(Entity *e); - /** * Destroys entities and clears vectors that contain them. * This function is only called in the world destructor. @@ -306,18 +306,6 @@ public: */ virtual void draw(Player *p); - /** - * Handles physics for all entities and the player. - * - * @see singleDetect() - */ - void detect(Player *p); - - /** - * Updates entity positions, time of day, and music. - */ - void update(Player *p, unsigned int delta); - /** * Gets the width of the world, presumably in pixels. * TODO -- cgit v1.2.3