diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-06-22 13:06:42 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-06-22 13:06:42 +0100 |
| commit | 5606e9f56d1333c32fd711a74f372669948bae8d (patch) | |
| tree | 287f5c28e9492663972cb1b5cdf04c6eb453fb4c /gaunt01/src/bird.cpp | |
| parent | 11a2a8968984d35e59809d5c4ef602db9fac52dc (diff) | |
new media files
Diffstat (limited to 'gaunt01/src/bird.cpp')
| -rw-r--r-- | gaunt01/src/bird.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/gaunt01/src/bird.cpp b/gaunt01/src/bird.cpp index 6e7ff92..fadfcab 100644 --- a/gaunt01/src/bird.cpp +++ b/gaunt01/src/bird.cpp @@ -17,19 +17,25 @@ bird::bird() if (model.loadSeqs("Bird-anim.xml")) printf("animation loaded with %i sequences\n",model.getNumSequences()); else printf("animation XML file not parsed\n"); - model.sequences["flap"].start(); + model.sequences["swoop"].start(); //how to track state/ bring animation in and out - state=SCANNING; + state=SWOOPING; - sounds=new ofSoundPlayer[7]; - sounds[0].loadSound("aggressive1.wav"); - sounds[1].loadSound("aggressive2.wav"); - sounds[2].loadSound("chirp1.wav"); - sounds[3].loadSound("chirp2.wav"); - sounds[4].loadSound("rattle1.wav"); - sounds[5].loadSound("rattle2.wav"); - sounds[6].loadSound("rattle3.wav"); + aggressives=new ofSoundPlayer[2]; + aggressives[0].loadSound("aggressive1.wav"); + aggressives[1].loadSound("aggressive2.wav"); + chirps=new ofSoundPlayer[2]; + chirps[0].loadSound("chirp1.wav"); + chirps[1].loadSound("chirp2.wav"); + rattles=new ofSoundPlayer[3]; + 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 texture.loadImage("TextureBird.jpg"); @@ -221,6 +227,8 @@ void bird::update(map<int,player>& players, float angle){ model.sequences["flap"].fadeout(0.5); model.sequences["swoop"].start(); state=SWOOPING; + int whichsound=(int)ofRandom(1.9999999); + chirps[whichsound].play(); } break; case SWOOPING: @@ -228,6 +236,8 @@ void bird::update(map<int,player>& players, float angle){ model.sequences["swoop"].fadeout(0.5); model.sequences["flap"].start(); state=SCANNING; + int whichsound=(int)ofRandom(2.9999999); + rattles[whichsound].play(); } break; case ATTACKING: @@ -252,6 +262,9 @@ void bird::update(map<int,player>& players, float angle){ //flap faster while climbing + swoop //bird noises + //where does it start + //whistles rather than chirps + heading=heading+(turnRate*timeSeg); while (heading>180) heading=heading-360; while (heading <-180) heading=heading+360; |
