summaryrefslogtreecommitdiff
path: root/gaunt01/src/player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gaunt01/src/player.cpp')
-rw-r--r--gaunt01/src/player.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/gaunt01/src/player.cpp b/gaunt01/src/player.cpp
index 39c91ac..0ffdcda 100644
--- a/gaunt01/src/player.cpp
+++ b/gaunt01/src/player.cpp
@@ -2,7 +2,7 @@
player::player()
{
- //ctor
+ isCaught=false;
}
player::~player()
@@ -10,12 +10,22 @@ player::~player()
//dtor
}
-void player::setPosition(ofVec3f _pos) {
- position.set(_pos);
+void player::setWorldPosition(ofVec3f _pos) {
+ worldPosition.set(_pos);
}
+void player::setScreenPosition(ofVec2f _pos) {
+ screenPosition.set(_pos);
+}
+
-ofVec3f player::getPosition() {
- return position;
+ofVec3f player::getWorldPosition() {
+ return worldPosition;
+}
+ofVec2f player::getScreenPosition() {
+ return screenPosition;
+}
+ofVec3f player::getCaughtPos(){
+ return caughtPos;
}
void player::update(ofxCvBlob blob) {
@@ -28,5 +38,24 @@ void player::update(ofxCvBlob blob) {
}
void player::draw(){
- billboard.draw();
+ ofPushMatrix();
+ if (isCaught) {
+ ofTranslate(caughtPos-screenPosition);
+ ofTranslate(catchPos);
+ ofTranslate(screenPosition);
+ ofScale(catchScale.x,catchScale.y,catchScale.z);
+ ofTranslate(-screenPosition);
+ }
+ billboard.draw();
+ ofPopMatrix();
+}
+
+void player::caught(){
+ isCaught=true;
+ caughtPos=screenPosition;
+}
+
+void player::setCatchTransform(ofVec3f _catchPos,ofVec3f _catchScale){
+ catchPos=_catchPos;
+ catchScale=_catchScale;
} \ No newline at end of file