diff options
Diffstat (limited to 'gaunt01/src/trapdoor.cpp')
| -rw-r--r-- | gaunt01/src/trapdoor.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gaunt01/src/trapdoor.cpp b/gaunt01/src/trapdoor.cpp index d1f436e..e1c37ec 100644 --- a/gaunt01/src/trapdoor.cpp +++ b/gaunt01/src/trapdoor.cpp @@ -2,7 +2,7 @@ trapdoor::trapdoor(ofVec2f _boundTR,ofVec2f _boundBR,ofVec2f _doorSize) { - surround=morphmesh("trapdoor-surround.xml"); + surround=morphmesh("trapdoor-surround.xml"); lid=morphmesh("trapdoor-lid.xml"); if (!surround.isLoaded()||!lid.isLoaded()) printf("problem loading trap door mesh.\n"); @@ -33,7 +33,7 @@ void trapdoor::start(){ float x=mx+((boundTR.x-mx)*u*(1-v))+((boundBR.x-mx)*u*v); float y=boundTR.y+((boundBR.y-boundTR.y)*v); - + startPos(ofVec2f(x,y)); } @@ -44,7 +44,7 @@ void trapdoor::startPos(ofVec2f pos){ doorSpeed=0; opening=false; //for (int i=0;i<4;i++) sounds[i].stop(); - + } vector<ofVec2f> trapdoor::getCorners(){ @@ -62,6 +62,12 @@ void trapdoor::setBoundingRect(float x,float y, float width,float height){ ofRectangle trapdoor::getBoundingRect(){ return boundingRect; } +ofRectangle trapdoor::getInnerRect() { + return ofRectangle(boundingRect.x+(boundingRect.width/4),boundingRect.y+(boundingRect.height/4),boundingRect.width/2,boundingRect.height/2); +} +void trapdoor::trigger() { + startTime=ofGetElapsedTimef()-10; +} ofVec2f trapdoor::bounds2UV(ofVec2f point){ //returns the 0-1 UV coords of a point on the ground plane relative to its bounds. @@ -73,7 +79,7 @@ ofVec2f trapdoor::bounds2UV(ofVec2f point){ bool trapdoor::checkUpdate(const vector<ofVec3f>& players) { float segTime=(ofGetElapsedTimef()-startTime); - if (segTime>3) { + if (segTime>10) { doorSpeed=(doorSpeed+((cos(doorAngle*0.0174532925)/ofGetFrameRate())*50))*0.95; doorAngle-=doorSpeed; if (!opening) { @@ -83,7 +89,7 @@ bool trapdoor::checkUpdate(const vector<ofVec3f>& players) { opening=true; } } - if (segTime>6) { + if (segTime>13) { start(); return true; } |
