summaryrefslogtreecommitdiff
path: root/gaunt01/src/bird.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gaunt01/src/bird.cpp')
-rw-r--r--gaunt01/src/bird.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/gaunt01/src/bird.cpp b/gaunt01/src/bird.cpp
index fe6bf17..b451c65 100644
--- a/gaunt01/src/bird.cpp
+++ b/gaunt01/src/bird.cpp
@@ -18,10 +18,10 @@ bird::bird()
else printf("animation XML file not parsed\n");
model.sequences["swoop"].start();
-
+
//how to track state/ bring animation in and out
state=SWOOPING;
-
+
aggressives=new ofSoundPlayer[2];
aggressives[0].loadSound("aggressive1.wav");
aggressives[1].loadSound("aggressive2.wav");
@@ -32,7 +32,7 @@ bird::bird()
rattles[0].loadSound("rattle1.wav");
rattles[1].loadSound("rattle2.wav");
rattles[2].loadSound("rattle3.wav");
-
+
//emit a rattle when the bird becomes vsisible and when it switches back to scanning
//emit a chirp when it switches to swooping
//emit an aggressive noise when it attacks
@@ -69,13 +69,13 @@ bird::~bird()
}
void bird::update(map<int,player>& players, float angle){
-
+
//movement basics
float time=ofGetElapsedTimef();
float timeSeg=time-lastTime;
lastTime=time;
-
+
//this is causing the bird to go off the screen at the start.. maybe not a problem..
pointer=ofRay(position.rotated(angle,ofVec3f(1,0,0)),-direction.rotated(heading,ofVec3f(0,0,-1)).rotated(angle,ofVec3f(1,0,0))*1000.0f,false);
@@ -112,7 +112,7 @@ void bird::update(map<int,player>& players, float angle){
}
*/
//avoiding edges is a bit of a nightmare
- //turnRate=(turnRate*.99)+(0.05f*max(0.0f,1.0f-(pow(edgelength*.0100f,2.0f)))*max(0.0f,90.0f-abs(edgeangle))*sign(edgeangle));
+ //turnRate=(turnRate*.99)+(0.05f*max(0.0f,1.0f-(pow(edgelength*.0100f,2.0f)))*max(0.0f,90.0f-abs(edgeangle))*sign(edgeangle));
//decide whether we are running out of space and if so, which way to turn#
//turning tendency is more acute when we are more perpendicular, and closer, to the edge
@@ -130,7 +130,7 @@ void bird::update(map<int,player>& players, float angle){
//bird floowing people while staying on screen
//bird changing height
//morph targets
-
+
//make a list of players within view and decide which one is the best target
//1sr draw lines and visualise
@@ -141,7 +141,7 @@ void bird::update(map<int,player>& players, float angle){
playpos.clear();
playhead.clear();
playdip.clear();
-
+
float nearest=1000000.0f;
int nearnum=-1;
int in=0;
@@ -172,7 +172,7 @@ void bird::update(map<int,player>& players, float angle){
}
}
}
-
+
//dive behaviour
if (nearnum>-1) {
//influence direction
@@ -199,11 +199,11 @@ void bird::update(map<int,player>& players, float angle){
diveRate-=0.05f;
}
}
- else diveRate*=0.9f;
+ else diveRate*=0.9f;
}
-
- float neardist=ofGetWidth()/12.0f;
-
+
+ float neardist=ofGetWidth()/20.0f;
+
if ((state==SCANNING||state==SWOOPING)&&nearnum>-1) {
if (playdist[nearnum]<neardist) {
model.sequences["flap"].fadeout(0.5);
@@ -214,7 +214,7 @@ void bird::update(map<int,player>& players, float angle){
aggressives[whichsound].play();
}
}
-
+
velocity *=(1.0f+(diveRate*.01));
//leave mode switch
switch (state) {
@@ -249,31 +249,31 @@ void bird::update(map<int,player>& players, float angle){
whistles[whichsound].play();
}
if (nearnum>-1) {
- velocity*=(19+(playdist[nearnum]/neardist))*.05; //slow down
+ velocity*=(9+(playdist[nearnum]/neardist))*.1; //slow down
}
break;
}
-
+
if (diveRate<0.0f) setSpeed(1.0f-diveRate);
else setSpeed(1.0f);
-
+
//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
-
+
//for now, when the bird hits the target they both blink and the board comes down?
- //initially, get the bird to connect with players-
+ //initially, get the bird to connect with players-
//integrate new keying
//interface - update info - save data
//do the documentation
//go back to the bird - watch out for dead players (from trap doors) - bird is going out of play - just retrieve it for now?
//flap faster while climbing + swoop
//bird noises
-
+
//increase angle of view and allow more extreme turn angles
-
+
heading=heading+(turnRate*timeSeg);
while (heading>180) heading=heading-360;
while (heading <-180) heading=heading+360;
@@ -322,8 +322,8 @@ void bird::drawDebug(){
sprintf(numStr, "dive: %4.2f\nheight: %4.2f\n%s\n%4.2f,%4.2f,%4.2f", diveRate,position.z,state==1?"SCANNING":state==2?"SWOOPING":"ATTACKING",position.x,position.y,position.z);
ofDrawBitmapString(numStr,10,10);
}
-
-
+
+
}
void bird::setSpeed(float speed){