summaryrefslogtreecommitdiff
path: root/gaunt01
diff options
context:
space:
mode:
Diffstat (limited to 'gaunt01')
-rw-r--r--gaunt01/src/bird.cpp19
-rw-r--r--gaunt01/src/bird.h2
-rw-r--r--gaunt01/src/testApp.cpp2
3 files changed, 14 insertions, 9 deletions
diff --git a/gaunt01/src/bird.cpp b/gaunt01/src/bird.cpp
index 2c4d5f2..9af751e 100644
--- a/gaunt01/src/bird.cpp
+++ b/gaunt01/src/bird.cpp
@@ -23,7 +23,7 @@ bird::bird()
texture.loadImage("TextureBird.jpg");
//starting pos
- position=ofVec3f(ofGetWidth()/2,ofGetHeight(),-ofGetHeight()/10);
+ position=ofVec3f(ofRandom(ofGetWidth()/4,(3*ofGetWidth())/4),ofRandom(ofGetHeight()/4,(3*ofGetHeight())/4),-ofGetHeight()/10);
heading=-90;
direction=ofVec3f(0,-1,0); //director for a heading of 0, level
velocity=1.0f/30;
@@ -126,7 +126,7 @@ void bird::update(map<int,player>& players, float angle){
edgeangle=(180.0f+(90.0f-(atan2(position.y-centre.y,position.x-centre.x)*RAD_TO_DEG)))-heading;
while (edgeangle>180.0f) edgeangle -=360.0f;
while (edgeangle<-180.0f) edgeangle +=360.0f;
- turnRate=(turnRate*.995)+(pow(0.002f*radius,2)*edgeangle*0.01);
+ turnRate=(turnRate*.90)+(pow(0.01f*radius,1)*edgeangle*0.01f);
//bird cruising while avoiding edges
//bird floowing people while staying on screen
@@ -148,6 +148,11 @@ void bird::update(map<int,player>& players, float angle){
int nearnum=-1;
int in=0;
+ //
+ // DEBUGGING feature
+ //
+ bool trackPlayers=true;
+
map<int,player>::iterator it;
for (it=players.begin();it!=players.end();it++) {
if (it->second.active) {
@@ -163,7 +168,7 @@ void bird::update(map<int,player>& players, float angle){
//maybe all of this is unnecessary if we are only following 1 - just save it if nearer
if (p.length() < nearest) {
nearest=p.length();
- nearnum=in;
+ if (trackPlayers) nearnum=in;
}
in++;
}
@@ -199,8 +204,8 @@ void bird::update(map<int,player>& players, float angle){
else diveRate*=0.9f;
}
- if (sign(turnRate)) turnRate=min(2.0f,turnRate);
- else turnRate=max(-2.0f,turnRate);
+ //if (sign(turnRate)) turnRate=min(2.0f,turnRate);
+ //else turnRate=max(-2.0f,turnRate);
//if high and target is in sight, swoop to gain speed
//if low and no narget is near, climb to gain a view
@@ -258,8 +263,8 @@ void bird::drawDebug(){
if (DEBUG) {
ofSetHexColor(0xff00ff);
- char numStr[64];
- sprintf(numStr, "dive: %4.2f\nheight: %4.2f", diveRate,position.z);
+ char numStr[100];
+ sprintf(numStr, "radius: %4.2f\nheading: %4.2f\nangle: %4.2f\ndive: %4.2f\nheight: %4.2f", centre.distance(ofVec2f(position.x,position.y)),heading,edgeangle,diveRate,position.z);
ofDrawBitmapString(numStr,10,10);
}
diff --git a/gaunt01/src/bird.h b/gaunt01/src/bird.h
index 11585c2..366f7f9 100644
--- a/gaunt01/src/bird.h
+++ b/gaunt01/src/bird.h
@@ -48,7 +48,7 @@
#include "ofxRay.h"
-#define DEBUG 0
+#define DEBUG 1
class bird
{
diff --git a/gaunt01/src/testApp.cpp b/gaunt01/src/testApp.cpp
index bb9bb10..efd9459 100644
--- a/gaunt01/src/testApp.cpp
+++ b/gaunt01/src/testApp.cpp
@@ -137,7 +137,7 @@ void testApp::setup(){
}
scaleFactor=ofVec2f(windowWidth/1280.0f,windowHeight/768.0f);
- gameState=PLAYING; //TITLES;
+ gameState=TITLES; //PLAYING; //
segTimes[TITLES]=4.0;
segTimes[CREDIT]=2.5;