[Orxonox-commit 6900] r11521 - in code/branches/FlappyOrx_HS17: data/levels src/modules/flappyorx
merholzl at orxonox.net
merholzl at orxonox.net
Mon Oct 30 16:17:14 CET 2017
Author: merholzl
Date: 2017-10-30 16:17:14 +0100 (Mon, 30 Oct 2017)
New Revision: 11521
Modified:
code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.h
code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
Log:
changes here and there
Modified: code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw
===================================================================
--- code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw 2017-10-30 15:12:04 UTC (rev 11520)
+++ code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw 2017-10-30 15:17:14 UTC (rev 11521)
@@ -58,7 +58,7 @@
linearDamping = 0.8
angularDamping = 0
scale = "<?lua print(10)?>"
- collisiondamage = 0
+ collisiondamage = 100000
enablecollisiondamage = true
>
@@ -76,7 +76,7 @@
linearDamping = 0.8
angularDamping = 0
scale = "<?lua print(10)?>"
- collisiondamage = 0
+ collisiondamage = 100000
enablecollisiondamage = true
>
Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc 2017-10-30 15:12:04 UTC (rev 11520)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc 2017-10-30 15:17:14 UTC (rev 11521)
@@ -60,7 +60,7 @@
this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
this->center_ = nullptr;
bEndGame = false;
- lives = 3;
+ lives = 1;
level = 1;
point = 0;
bShowLevel = false;
Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc 2017-10-30 15:12:04 UTC (rev 11520)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc 2017-10-30 15:17:14 UTC (rev 11521)
@@ -50,10 +50,10 @@
{
SUPER(FlappyOrxHUDinfo, XMLPort, xmlelement, mode);
- XMLPortParam(FlappyOrxHUDinfo, "showlives", setShowLives, getShowLives, xmlelement, mode).defaultValues(false);
- XMLPortParam(FlappyOrxHUDinfo, "showPoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false);
- XMLPortParam(FlappyOrxHUDinfo, "showLevel", setShowLevel, getShowLevel, xmlelement, mode).defaultValues(false);
- XMLPortParam(FlappyOrxHUDinfo, "showMultiplier", setShowMultiplier, getShowMultiplier, xmlelement, mode).defaultValues(false);
+ // XMLPortParam(FlappyOrxHUDinfo, "showlives", setShowLives, getShowLives, xmlelement, mode).defaultValues(false);
+ XMLPortParam(FlappyOrxHUDinfo, "showPoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false);
+ // XMLPortParam(FlappyOrxHUDinfo, "showLevel", setShowLevel, getShowLevel, xmlelement, mode).defaultValues(false);
+ // XMLPortParam(FlappyOrxHUDinfo, "showMultiplier", setShowMultiplier, getShowMultiplier, xmlelement, mode).defaultValues(false);
}
void FlappyOrxHUDinfo::tick(float dt)
@@ -62,38 +62,38 @@
if (this->FlappyOrxGame)
{
- if (this->bShowLives_)
+ // if (this->bShowLives_)
+ // {
+ // const std::string& lives = multi_cast<std::string>(this->FlappyOrxGame->getLives());
+ // this->setCaption(lives);
+ // }
+ // else if(this->bShowLevel_)
+ // {
+ // const std::string& Level = multi_cast<std::string>(this->FlappyOrxGame->getLevel());
+ // if (this->FlappyOrxGame->lives <= 0)
+ // {
+ // setPosition(Vector2(0.1, 0.65));
+ // this->setCaption("Game ends in 30 seconds.\nPress (e)xit / (q)uit to go to the main menu.\nTo restart fly out of the screen!");
+ // setTextSize(0.05);
+ // this->FlappyOrxGame->bEndGame = true;
+ // }
+ // else if (this->FlappyOrxGame->bShowLevel)
+ // {
+ // setTextSize(0.1);
+ // setPosition(Vector2(0.3, 0.55));
+ // std::stringstream sstm;
+ // sstm << "Level " << Level;
+ // this->setCaption(sstm.str()); // + level
+ // }
+ // else
+ // {
+ // setTextSize(0.04);
+ // setPosition(Vector2(0.14, 0.055));
+ // this->setCaption(Level);
+ // }
+ // }
+ if(this->bShowPoints_)
{
- const std::string& lives = multi_cast<std::string>(this->FlappyOrxGame->getLives());
- this->setCaption(lives);
- }
- else if(this->bShowLevel_)
- {
- const std::string& Level = multi_cast<std::string>(this->FlappyOrxGame->getLevel());
- if (this->FlappyOrxGame->lives <= 0)
- {
- setPosition(Vector2(0.1, 0.65));
- this->setCaption("Game ends in 30 seconds.\nPress (e)xit / (q)uit to go to the main menu.\nTo restart fly out of the screen!");
- setTextSize(0.05);
- this->FlappyOrxGame->bEndGame = true;
- }
- else if (this->FlappyOrxGame->bShowLevel)
- {
- setTextSize(0.1);
- setPosition(Vector2(0.3, 0.55));
- std::stringstream sstm;
- sstm << "Level " << Level;
- this->setCaption(sstm.str()); // + level
- }
- else
- {
- setTextSize(0.04);
- setPosition(Vector2(0.14, 0.055));
- this->setCaption(Level);
- }
- }
- else if(this->bShowPoints_)
- {
const std::string& points = multi_cast<std::string>(this->FlappyOrxGame->getPoints());
if (this->FlappyOrxGame->lives <= 0)
{
@@ -110,14 +110,14 @@
this->setCaption(points);
}
}
- else if(this->bShowMultiplier_)
- {
- int mult = this->FlappyOrxGame->getMultiplier();
- const std::string& Multiplier = "X " + multi_cast<std::string>(mult);
- this->setCaption(Multiplier);
- this->setColour(ColourValue(1, 0, 0, clamp(float(mult * 0.1), 0.0f, 1.0f)));
- this->setTextSize(clamp(float(mult * 0.1), 0.0f, 1.0f) * 0.01f + 0.04f);
- }
+ // else if(this->bShowMultiplier_)
+ // {
+ // int mult = this->FlappyOrxGame->getMultiplier();
+ // const std::string& Multiplier = "X " + multi_cast<std::string>(mult);
+ // this->setCaption(Multiplier);
+ // this->setColour(ColourValue(1, 0, 0, clamp(float(mult * 0.1), 0.0f, 1.0f)));
+ // this->setTextSize(clamp(float(mult * 0.1), 0.0f, 1.0f) * 0.01f + 0.04f);
+ // }
}
}
Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.h
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.h 2017-10-30 15:12:04 UTC (rev 11520)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.h 2017-10-30 15:17:14 UTC (rev 11521)
@@ -44,12 +44,12 @@
virtual void changedOwner() override;
inline void setShowLives(bool value)
- { this->bShowLives_ = value; }
+ { this->bShowLives_ = false; }
inline bool getShowLives() const
{ return this->bShowLives_; }
inline void setShowLevel(bool value)
- { this->bShowLevel_ = value; }
+ { this->bShowLevel_ = false; }
inline bool getShowLevel() const
{ return this->bShowLevel_; }
@@ -59,7 +59,7 @@
{ return this->bShowPoints_; }
inline void setShowMultiplier(bool value)
- { this->bShowMultiplier_ = value; }
+ { this->bShowMultiplier_ = false; }
inline bool getShowMultiplier() const
{ return this->bShowMultiplier_; }
Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc 2017-10-30 15:12:04 UTC (rev 11520)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc 2017-10-30 15:17:14 UTC (rev 11521)
@@ -49,7 +49,7 @@
RegisterObject(FlappyOrxShip);
this->UpwardThrust = 1;
- this->speed = 1;orxout() << "constr speed set: " << 1 << endl;
+ this->speed = 1;
this->gravity = 1;
}
@@ -67,7 +67,10 @@
//Execute movement
if (this->hasLocalController())
{
-
+ if(getHealth()<0){
+ getGame()->costLife();
+ getGame()->end();
+ }
Vector3 pos = getPosition();
velocity.y += gravity;
if(isFlapping){
More information about the Orxonox-commit
mailing list