aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2015-09-10 11:31:30 -0400
committerClyne Sullivan <tullivan99@gmail.com>2015-09-10 11:31:30 -0400
commita3db993224c994fdff6f50fedcc266c5e0b94aa8 (patch)
tree74d24408ecd5479b2d9cb57d7d904f0336556abe
parent3fde0e7edf310245e5658b767840e742c9341597 (diff)
added entities
-rw-r--r--doc/World.htm40
-rw-r--r--include/entities.h26
-rw-r--r--src/entities.cpp16
3 files changed, 82 insertions, 0 deletions
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 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>World</title>
+ <style>
+ .code{
+ background:#555;
+ color:white;
+ font-family:Consolas;
+ font-size:12px;
+ margin:auto 20px;
+ padding:20px;
+ }
+ </style>
+</head>
+<body>
+ <h1>World</h1>
+ <hr>
+ <h2>Description</h2>
+ <p>World.h contains functions to create and draw worlds, and provide basic object detection.</p>
+ <br>
+ <p>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. ...</p>
+ <h3>class World</h3>
+ <div class="code"><b>private:</b><br>
+ struct line_t {<br>
+ float start;<br>
+ } *line;<br>
+ unsigned int lineCount;<br>
+<b>public:</b><br>
+ World(float width);<br>
+ void draw(void);<br>
+ void detect(vec2 *v,const float width);<br>
+ </div>
+ <ul>
+ <li>struct line_t: float <b>start</b>: Where the top of the line is located.</li>
+ <li>unsigned int <b>lineCount</b>: Contains the size of the array <i>line</i>.</li>
+ </ul>
+</body>
+</html>
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 <common.h>
+
+
+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 <entities.h>
+
+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