From 6a55426a506c63eee7b8dea2967a6a5f5ecde038 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 25 Nov 2016 19:29:33 -0500 Subject: wandering --- include/components.hpp | 32 +++++++++++++++++++++++++++----- include/world.hpp | 4 ++-- 2 files changed, 29 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/components.hpp b/include/components.hpp index 1c83a34..58f5aea 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -111,7 +111,7 @@ struct Solid { */ Solid(float w = 0.0f, float h = 0.0f): width(w), height(h) {offset = 0.0f; passable = true; } //Solid(float w = 0.0f, float h = 0.0f, vec2 offset = 0.0f): width(w), height(h), offset(offset) {passable = true; } - + void Passable(bool v) {passable = v;} bool Passable(void) {return passable;} @@ -122,13 +122,13 @@ struct Solid { }; struct SpriteData { - - SpriteData(std::string path, vec2 offset): + + SpriteData(std::string path, vec2 offset): offset(offset) { pic = Texture::loadTexture(path); size = Texture::imageDim(path); } - + GLuint pic; vec2 offset; vec2 size; @@ -177,7 +177,7 @@ struct Sprite { vec2 getSpriteSize() { vec2 st; /** the start location of the sprite */ vec2 dim; /** how wide the sprite is */ - + if (sprite.size()) { st.x = sprite[0].second.x; st.y = sprite[0].second.y; @@ -238,6 +238,28 @@ struct Dialog { int rindex; }; + + +// movement styles + +/** + * Causes the entity to hop around. + */ +struct Hop {}; // TODO require wander, for range? + +/** + * Causes the entity to wander about. + */ +struct Wander { + Wander(float ix = 0, float r = 0) + : initialX(ix), range(r), countdown(0) {} + + float initialX; + float range; + int countdown; +}; + + /** * SYSTEMS */ diff --git a/include/world.hpp b/include/world.hpp index 308222d..cb8c30d 100644 --- a/include/world.hpp +++ b/include/world.hpp @@ -175,7 +175,7 @@ public: ev.subscribe(*this); } - inline XMLDocument* getXML(void) + inline XMLDocument* getXML(void) { return &xmlDoc; } inline float getWidth(void) const @@ -210,7 +210,7 @@ public: void addHole(const unsigned int& start, const unsigned int& end); void addHill(const ivec2& peak, const unsigned int& width); - bool save(const std::string& file); + bool save(void); void load(const std::string& file); }; -- cgit v1.2.3