From 5606e9f56d1333c32fd711a74f372669948bae8d Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 22 Jun 2012 13:06:42 +0100 Subject: new media files --- gaunt01/src/bird.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'gaunt01/src/bird.cpp') 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& 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& 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& 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; -- cgit v1.2.3