[Orxonox-commit 7362] r11979 - in code/branches/3DPacman_FS18: data/overlays src/modules/pacman
dreherm at orxonox.net
dreherm at orxonox.net
Tue May 22 13:04:40 CEST 2018
Author: dreherm
Date: 2018-05-22 13:04:40 +0200 (Tue, 22 May 2018)
New Revision: 11979
Modified:
code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc
Log:
Debugged levelup
Modified: code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo
===================================================================
--- code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo 2018-05-22 11:04:40 UTC (rev 11979)
@@ -57,5 +57,16 @@
showlive = true
/>
+ <PacmanHUDinfo
+ position = "0.5, 0.5"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.04
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+
+ showlevel = true
+ />
+
</OverlayGroup>
</Template>
Modified: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc 2018-05-22 11:04:40 UTC (rev 11979)
@@ -63,6 +63,9 @@
nextghost->levelupvelo();
}
this->posreset();
+
+ totallevelpoint = ObjectList<PacmanPointSphere>().size() + totallevelpoint;
+ level++;
}
@@ -123,11 +126,8 @@
}
}
- }
+ }
-
-
-
}
@@ -192,6 +192,10 @@
return timer;
}
+ int Pacman::getLevel(){
+ return level;
+ }
+
void Pacman::posreset(){
for(int i = 0; i<4; ++i){
ghosts[i]->resetGhost();
@@ -201,7 +205,10 @@
void Pacman::takePoint(PacmanPointSphere* taken){
++point;
- if(point == totallevelpoint) this->levelUp();
+ if(point == totallevelpoint){
+ this->levelUp();
+ return;
+ }
Vector3 postaken = taken->getPosition();
postaken.y = -50;
taken->setPosition(postaken);
Modified: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h 2018-05-22 11:04:40 UTC (rev 11979)
@@ -86,6 +86,7 @@
bool getAfraid();
int getTimer();
int getLives();
+ int getLevel();
bool bEndGame;
Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h 2018-05-22 11:04:40 UTC (rev 11979)
@@ -58,8 +58,8 @@
Pawn::rotateYaw(value);
// This function call adds a lift to the ship when it is rotating to make it's movement more "realistic" and enhance the feeling.
- if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_)
- this->moveRightLeft(-lift_ / 5.0f * value * sqrt(std::abs(this->getLocalVelocity().y)));
+ //if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_)
+ //this->moveRightLeft(-lift_ / 5.0f * value * sqrt(std::abs(this->getLocalVelocity().y)));
};
virtual void rotatePitch(const Vector2& value) override{};
Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc 2018-05-22 11:04:40 UTC (rev 11979)
@@ -116,11 +116,11 @@
//Move, if ghost hasn't arrived yet
if(this->ismoving){
if(!(abs(this->actuelposition.z-target_z)<0.5)) {
- velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)*2);
+ velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
move(dt, actuelposition, velocity);
}
if(!(abs(this->actuelposition.x-target_x)<0.5)){
- velocity = Vector3(-sgn(this->actuelposition.x-this->target_x)*2,0,0);
+ velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
move(dt, actuelposition, velocity);
}
}
@@ -439,8 +439,8 @@
void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){
if(!dontmove){
- this->setPosition(Vector3(actuelposition.x+20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt));
- if((abs(abs(velocity.x)-2)<0.1) && (abs(velocity.z-0)<0.1))
+ this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt));
+ if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1))
if(velocity.x<0){
this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0)));
}
@@ -447,7 +447,7 @@
else{
this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0)));
}
- if((abs(abs(velocity.z)-2)<0.1) && (abs(velocity.x-0)<0.1))
+ if((abs(abs(velocity.z)-1)<0.1) && (abs(velocity.x-0)<0.1))
if(velocity.z<0){
this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0)));
}
@@ -484,8 +484,6 @@
}
void PacmanGhost::levelupvelo(){
- velocity.x = velocity.x + 2;
- velocity.y = velocity.y + 2;
- velocity.z = velocity.z + 2;
+ speed ++;
}
}
\ No newline at end of file
Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h 2018-05-22 11:04:40 UTC (rev 11979)
@@ -68,6 +68,7 @@
int target_z = 0;
Vector3 velocity;
Vector3 oldvelocity = Vector3(2,0,0);
+ int speed = 20;
private:
int decision = 0; //Gives the random which way information to the ghost.
Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc 2018-05-22 11:04:40 UTC (rev 11979)
@@ -59,6 +59,7 @@
XMLPortParam(PacmanHUDinfo, "messageID", setMessageID, getMessageID, xmlelement, mode).defaultValues(0);
XMLPortParam(PacmanHUDinfo, "showgameover", setGameover, getGameover, xmlelement, mode).defaultValues(false);
XMLPortParam(PacmanHUDinfo, "showlive", setlive, getlive, xmlelement, mode).defaultValues(false);
+ XMLPortParam(PacmanHUDinfo, "showlevel", setlevel, getlevel, xmlelement, mode).defaultValues(false);
}
@@ -101,6 +102,13 @@
this->setCaption(live);
}
+ if(this->showlevel){
+ const std::string& live = "Level: "+multi_cast<std::string>(this->PacmanGame->getLevel());
+ setTextSize(0.03);
+ this->setCaption(live);
+ }
+
+
if(death && !(this->showgameover)){
setTextSize(0.0);
}
Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h 2018-05-22 11:04:40 UTC (rev 11979)
@@ -80,7 +80,13 @@
inline int getlive() const
{ return this->showlive; }
+ inline void setlevel(bool value){
+ this->showlevel = value;
+ }
+ inline int getlevel() const
+ { return this->showlevel; }
+
private:
Pacman* PacmanGame;
bool bShowPoints_;
@@ -88,6 +94,7 @@
bool bShowGhoststatus_;
bool showgameover;
bool showlive;
+ bool showlevel;
int messageID;
};
}
Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc 2018-05-22 11:04:40 UTC (rev 11979)
@@ -84,6 +84,8 @@
void PacmanPointAfraid::resetPacmanPointAfraid(){
+ resetposition = this->getPosition();
+ resetposition.y = 10;
this->setPosition(resetposition);
}
}
Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc 2018-05-18 10:38:37 UTC (rev 11978)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc 2018-05-22 11:04:40 UTC (rev 11979)
@@ -84,6 +84,8 @@
void PacmanPointSphere::resetPacmanPointSphere(){
+ resetposition = this->getPosition();
+ resetposition.y = 10;
this->setPosition(resetposition);
}
}
More information about the Orxonox-commit
mailing list