summaryrefslogtreecommitdiff
path: root/gaunt01/src/bird.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2012-04-05 14:00:51 +0100
committerTim Redfern <tim@eclectronics.org>2012-04-05 14:00:51 +0100
commitf65006daf4979d82d67fd8c8a234d3913088821d (patch)
tree104d30c316ca295cd4bad1110c7f341640112738 /gaunt01/src/bird.cpp
parent0c2a97dcc0fb370938dc0d2d3a27053c2c9cb31e (diff)
starting to implement bird
Diffstat (limited to 'gaunt01/src/bird.cpp')
-rw-r--r--gaunt01/src/bird.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/gaunt01/src/bird.cpp b/gaunt01/src/bird.cpp
new file mode 100644
index 0000000..204bf6e
--- /dev/null
+++ b/gaunt01/src/bird.cpp
@@ -0,0 +1,42 @@
+#include "bird.h"
+
+bird::bird()
+{
+ model.loadMesh("Bird-test.xml");
+ texture.loadImage("TextureBird.jpg");
+
+ //starting pos
+ position=ofVec3f(ofGetWidth()/2,ofGetHeight()/3,ofGetHeight()/2);
+ heading=ofVec3f(-1,0,0);
+ direction=ofVec3f(-1,0,0);
+ velocity=ofGetWidth()/100;
+
+ turnAngle=0;
+ diveAngle=0;
+
+ lastTime=ofGetElapsedTimef();
+}
+
+bird::~bird()
+{
+ //dtor
+}
+
+void bird::update(const vector<ofVec3f>& players){
+ float time=ofGetElapsedTimef();
+ float timeSeg=time-lastTime;
+ lastTime=time;
+ position+=direction*velocity*timeSeg;
+}
+void bird::draw(){
+ ofPushMatrix();
+ ofTranslate(position);
+ //ofRotate(direction);
+ ofRotate(90,0,-1,0);
+ //ofRotate(180,1,0,0);
+ bindTexture(texture);
+ model.draw();
+ unbindTexture(texture);
+ ofPopMatrix();
+}
+