[Orxonox-commit 7685] r12278 - in code/branches/OrxoBlox_FS19: data/levels src/modules/OrxoBlox
ahuwyler at orxonox.net
ahuwyler at orxonox.net
Thu Apr 4 16:17:27 CEST 2019
Author: ahuwyler
Date: 2019-04-04 16:17:26 +0200 (Thu, 04 Apr 2019)
New Revision: 12278
Added:
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h
Modified:
code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
Log:
Class Wall is created
Modified: code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw
===================================================================
--- code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw 2019-04-04 14:16:22 UTC (rev 12277)
+++ code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw 2019-04-04 14:17:26 UTC (rev 12278)
@@ -64,7 +64,7 @@
<?lua include("includes/notifications.oxi") ?>
<WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true"/>
- <OrxoBloxBot />
+
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt 2019-04-04 14:16:22 UTC (rev 12277)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt 2019-04-04 14:17:26 UTC (rev 12278)
@@ -5,7 +5,7 @@
BallGun/BallMunition.cc
BallGun/BallProjectile.cc
OrxoBlox.cc
-
+ OrxoBloxWall.cc
OrxoBloxBall.cc
OrxoBloxBat.cc
OrxoBloxBot.cc
Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc 2019-04-04 14:16:22 UTC (rev 12277)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc 2019-04-04 14:17:26 UTC (rev 12278)
@@ -277,6 +277,13 @@
this->starttimer_.startTimer();
}
+ /*void OrxoBlox::createStonewall(void){
+ this->futureWall_ = new OrxoBolxWall(this->center_->getContext());
+
+
+
+ }*/
+
/**
@brief
Starts the ball with some default speed.
Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc 2019-04-04 14:16:22 UTC (rev 12277)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc 2019-04-04 14:17:26 UTC (rev 12278)
@@ -169,6 +169,8 @@
{
// Calculate the distance (in z-direction) between the ball and the center of the bat, weighted by half of the effective length of the bat (with additional 10%)
distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
+
+
if (fabs(distance) <= 1) // If the bat is there to parry.
{
defBatSound_->play(); //play bat sound
@@ -182,16 +184,26 @@
this->fireEvent();
}
+
// If the left player scores.
else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
{
+ ChatManager::message("You suck!!");
defScoreSound_->play();//play score sound
if (this->getGametype() && this->bat_[0])
{
+ ChatManager::message("You suck!!");
+
+
this->getGametype()->playerScored(this->bat_[0]->getPlayer());
return;
}
}
+
+
+
+
+
}
// If the left boundary has been crossed.
else if (position.x < -this->fieldWidth_ / 2 && this->bat_[0] != nullptr)
@@ -217,6 +229,8 @@
defScoreSound_->play();//play score sound
if (this->getGametype() && this->bat_[1])
{
+ ChatManager::message("You suck!!");
+
this->getGametype()->playerScored(this->bat_[1]->getPlayer());
return;
}
Added: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc (rev 0)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc 2019-04-04 14:17:26 UTC (rev 12278)
@@ -0,0 +1,21 @@
+#include "OrxoBloxWall.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "OrxoBlox.h"
+
+namespace orxonox
+{
+ RegisterClass(OrxoBloxWall);
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ OrxoBloxWall::OrxoBloxWall(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(OrxoBloxWall);
+
+ this->health_ = 10;
+ this->delay_ = false;
+ }
+}
\ No newline at end of file
Added: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h (rev 0)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h 2019-04-04 14:17:26 UTC (rev 12278)
@@ -0,0 +1,58 @@
+#ifndef _OrxoBloxWall_H__
+#define _OrxoBloxWall_H__
+
+
+#include "worldentities/StaticEntity.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+
+ @author
+
+ @ingroup OrxoBlox
+ */
+ class _OrxoBloxExport OrxoBloxWall : public StaticEntity
+ {
+ public:
+ OrxoBloxWall(Context* context); //!< Constructor. Registers and initializes the object.
+ virtual ~OrxoBloxWall() {}
+ // this.destroy();
+ //}
+
+ /**
+ @brief Set the Health of the stone.
+ @param size The dimensions a stone has in the game world. (A stone is a cube)
+ */
+ void setHealth(unsigned int health)
+ {
+ this->health_ = health;
+ }
+ /**
+ @brief Get the size of the stone.
+ @return Returns the dimensions a stone has in the game world. (A stone is a cube)
+ */
+ unsigned int getHealth(void) const
+ { return this->health_; }
+
+ void gotHit(){
+ if (this->health_ > 0){
+ this->health_ -= this->health_;
+ }
+ // else ~OrxoBloxStones();
+ }
+
+
+ private:
+ unsigned int health_;
+ bool delay_;
+
+
+
+ };
+}
+
+#endif /* _OrxoBloxWall_H__ */
\ No newline at end of file
More information about the Orxonox-commit
mailing list