From a3db993224c994fdff6f50fedcc266c5e0b94aa8 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 10 Sep 2015 11:31:30 -0400 Subject: added entities --- doc/World.htm | 40 ++++++++++++++++++++++++++++++++++++++++ include/entities.h | 26 ++++++++++++++++++++++++++ src/entities.cpp | 16 ++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 doc/World.htm create mode 100644 include/entities.h create mode 100644 src/entities.cpp diff --git a/doc/World.htm b/doc/World.htm new file mode 100644 index 0000000..d17c551 --- /dev/null +++ b/doc/World.htm @@ -0,0 +1,40 @@ + + + + World + + + +

World

+
+

Description

+

World.h contains functions to create and draw worlds, and provide basic object detection.

+
+

The standard form of world generation in World.h is an array of randomly sized vertical lines. +The width of each line is defined as a single HLINE, a macro defined in common.h. ...

+

class World

+
private:
+ struct line_t {
+ float start;
+ } *line;
+ unsigned int lineCount;
+public:
+ World(float width);
+ void draw(void);
+ void detect(vec2 *v,const float width);
+
+ + + diff --git a/include/entities.h b/include/entities.h new file mode 100644 index 0000000..3ecf014 --- /dev/null +++ b/include/entities.h @@ -0,0 +1,26 @@ +#ifndef ENTITIES_H +#define ENTITIES_H + +#include + + +class Entities{ +public: + float width; + float height; + float speed; + int type; + vec2 loc; + + void spawn(float, float); + + +}; + +class Player : public Entities{ +public: + Player(); + ~Player(); +}; + +#endif //ENTITIES_H \ No newline at end of file diff --git a/src/entities.cpp b/src/entities.cpp new file mode 100644 index 0000000..5e86b72 --- /dev/null +++ b/src/entities.cpp @@ -0,0 +1,16 @@ +#include + +void Entities::spawn(float x, float y){ + loc.x = x; + loc.y = y; + +} + +Player::Player(){ + width = 24; + height = 42; + speed = 1; + type = 0; +} + +Player::~Player(){} \ No newline at end of file -- cgit v1.2.3