[Orxonox-commit 7784] r12376 - in code/branches/OrxoBlox_FS19/src/modules: OrxoBlox weapons/projectiles
jeromela at orxonox.net
jeromela at orxonox.net
Thu May 16 14:20:38 CEST 2019
Author: jeromela
Date: 2019-05-16 14:20:38 +0200 (Thu, 16 May 2019)
New Revision: 12376
Modified:
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc
code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BasicProjectile.cc
Log:
cleanup function worksls!
Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc 2019-05-16 12:05:52 UTC (rev 12375)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc 2019-05-16 12:20:38 UTC (rev 12376)
@@ -97,7 +97,7 @@
Cleans up the Gametype by destroying the ball and the bats.
*/
void OrxoBlox::cleanup()
- {
+ {
//if (this->ball_ != nullptr) // Destroy the ball, if present.
//{
// this->ball_->destroy();
@@ -104,15 +104,16 @@
// this->ball_ = nullptr;
//}
- if (this->futureWall_ != nullptr)
+ /*if (this->futureWall_ != nullptr)
{
this->futureWall_->destroy();
this->futureWall_ = nullptr;
}
-
+ */
+
for (OrxoBloxWall* wall : this->activeWalls_)
if (wall != nullptr)
- wall->destroy();
+ wall->destroy();
this->activeWalls_.clear();
@@ -131,6 +132,7 @@
void OrxoBlox::start()
{
+ orxout() << "Orxoblox started" << endl;
if (this->center_ != nullptr) // There needs to be a OrxoBloxCenterpoint, i.e. the area the game takes place.
{
//if (this->ball_ == nullptr) // If there is no ball, create a new ball.
@@ -221,18 +223,18 @@
void OrxoBlox::LevelUp(){
level_++;
+ int z_;
+
+ orxout() << "level up called" << endl;
this->playerScored(this->player_);// add points
for(OrxoBloxStones* stone : this->stones_){
int x_=(stone->getPosition()).x;
int y_=(stone->getPosition()).y;
- int z_=(stone->getPosition()).z;
+ z_=(stone->getPosition()).z;
//if(z_==90)this->end();
stone->setPosition(x_,y_,z_+9.0f);
-
- if( z_ >= 45){
- this->end();
- }
+
}
@@ -265,6 +267,11 @@
//new amount of balls
//create balls
//insert new wall
+ if( z_ >= 45){
+ orxout() << "calling end() function" << endl;
+ this->end();
+ }
+
}
void OrxoBlox::createWall(){
Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc 2019-05-16 12:05:52 UTC (rev 12375)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc 2019-05-16 12:20:38 UTC (rev 12376)
@@ -127,7 +127,8 @@
The time since the last tick.
*/
void OrxoBloxBall::tick(float dt)
- {
+ {
+
SUPER(OrxoBloxBall, tick, dt);
// Get the current position, velocity and acceleration of the ball.
@@ -147,8 +148,12 @@
position.z = this-> fieldHeight_ / 2 - radius_;
orxoblox_->LevelUp();
+ orxoblox_->LevelUp();
+ orxout() << "LevelUp 2 finished, trying to call end() function";
+ //this->end();
+
//this->setSpeed(0); // doesn't work here, why??;
//Stopping ball
orxout() << "Ball stopped" << endl;
@@ -293,7 +298,7 @@
Vector3 velocity = this->getVelocity();
Vector3 positionStone = Stone->getPosition();
Vector3 myPosition = this->getPosition();
- orxout() << "About to Bounce >D" << endl;
+ //orxout() << "About to Bounce >D" << endl;
int distance_X = myPosition.x - positionStone.x;
int distance_Z = myPosition.z - positionStone.z;
@@ -305,21 +310,21 @@
if (distance_Z < 0)
distance_Z = -distance_Z;
- orxout() << distance_X << endl;
- orxout() << distance_Z << endl;
+ //orxout() << distance_X << endl;
+ //orxout() << distance_Z << endl;
if (distance_X < distance_Z) {
velocity.z = -velocity.z;
- orxout() << "z" << endl;
+ //orxout() << "z" << endl;
}
else if (distance_Z < distance_X) {
velocity.x = -velocity.x;
- orxout() << "x" << endl;
+ //orxout() << "x" << endl;
}
else {
velocity.x = -velocity.x;
velocity.z = -velocity.z;
- orxout() << "both" << endl;
+ //orxout() << "both" << endl;
}
this->setVelocity(velocity);
Modified: code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc 2019-05-16 12:05:52 UTC (rev 12375)
+++ code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc 2019-05-16 12:20:38 UTC (rev 12376)
@@ -103,7 +103,7 @@
Vector3 velocity = this->getVelocity();
Vector3 myPosition = otherObject->getPosition();
btVector3 positionOtherObject = contactPoint.getPositionWorldOnA();
- orxout() << "About to Bounce >D" << endl;
+ //orxout() << "About to Bounce >D" << endl;
//if (positionOtherObject.y < 0) {
//this.destroy()
//}S
@@ -119,21 +119,21 @@
if (distance_Z < 0)
distance_Z = -distance_Z;
- orxout() << distance_X << endl;
- orxout() << distance_Z << endl;
+ //orxout() << distance_X << endl;
+ //orxout() << distance_Z << endl;
if (distance_X < distance_Z) {
velocity.z = -velocity.z;
- orxout() << "z" << endl;
+ //orxout() << "z" << endl;
}
if (distance_Z < distance_X) {
velocity.x = -velocity.x;
- orxout() << "x" << endl;
+ //orxout() << "x" << endl;
}
else {
velocity.x = -velocity.x;
velocity.z = -velocity.z;
- orxout() << "both" << endl;
+ //orxout() << "both" << endl;
}
this->setVelocity(velocity);
//}
@@ -143,7 +143,7 @@
bool BallProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs)
{
- orxout() << "wanna bounce..." << endl;
+ //orxout() << "wanna bounce..." << endl;
bool result = BasicProjectile::processCollision(otherObject, contactPoint, cs);
if (result == true) {
if (otherObject->isA(Class(OrxoBloxStones))) {
@@ -150,7 +150,7 @@
Bounce(otherObject, contactPoint, cs);
}
}
- orxout() << "BOUNCED!" << endl;
+ //orxout() << "BOUNCED!" << endl;
return result;
}
@@ -197,7 +197,7 @@
//this->setSpeed(0); // doesn't work here, why??;
//Stopping ball
- orxout() << "Ball stopped" << endl;
+ //orxout() << "Ball stopped" << endl;
velocity.x = 0;
velocity.y = 0;
velocity.z = 0;
Modified: code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BasicProjectile.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BasicProjectile.cc 2019-05-16 12:05:52 UTC (rev 12375)
+++ code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BasicProjectile.cc 2019-05-16 12:20:38 UTC (rev 12376)
@@ -84,7 +84,7 @@
*/
bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs)
{
- orxout() << "OMG A COLLISION" << endl;
+ //orxout() << "OMG A COLLISION" << endl;
if (!this->bDestroy_ && GameMode::isMaster())
{
if (this->isObjectRelatedToShooter(otherObject) || otherObject->isA(Class(BasicProjectile))) // Prevents you from shooting yourself or other projectiles
More information about the Orxonox-commit
mailing list