[Orxonox-commit 7010] r11629 - in code/branches/SOBv2_HS17: data/levels src/modules/superorxobros
zarron at orxonox.net
zarron at orxonox.net
Mon Dec 4 15:36:20 CET 2017
Author: zarron
Date: 2017-12-04 15:36:20 +0100 (Mon, 04 Dec 2017)
New Revision: 11629
Modified:
code/branches/SOBv2_HS17/data/levels/SOB.oxw
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.cc
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.h
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h
Log:
Boss now working
Modified: code/branches/SOBv2_HS17/data/levels/SOB.oxw
===================================================================
--- code/branches/SOBv2_HS17/data/levels/SOB.oxw 2017-12-04 14:29:13 UTC (rev 11628)
+++ code/branches/SOBv2_HS17/data/levels/SOB.oxw 2017-12-04 14:36:20 UTC (rev 11629)
@@ -78,6 +78,16 @@
</SOBFireball>
</Template>
+ <Template name=gumbaShootable>
+ <SOBGumbaBoss collisionType="dynamic" speed=40>
+ <attached>
+ <Model mesh="Goomba.mesh" position="0,0,1" scale=3 pitch=90/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,3" />
+ </collisionShapes>
+ </SOBGumbaBoss>
+ </Template>
<Level
@@ -116,7 +126,7 @@
- <SOBGumbaBoss collisionType="dynamic" speed=40 position = "240,0,0">
+ <SOBGumba collisionType="dynamic" speed=40 position = "240,0,0">
<attached>
<Model mesh="Goomba.mesh" position="0,0,1" scale=3 pitch=90/>
@@ -124,7 +134,7 @@
<collisionShapes>
<BoxCollisionShape position="0,0,0" halfExtents="5,5,3" />
</collisionShapes>
- </SOBGumbaBoss>
+ </SOBGumba>
<SOBGumba collisionType="dynamic" speed=30 position = "420,0,0">
<attached>
@@ -214,17 +224,17 @@
</SOBGumba>
<!--GumbaBoss-->
- <SOBGumba collisionType="dynamic" speed=30 position = "1750,0,0">
+ <SOBGumbaBoss collisionType="dynamic" speed=20 position = "1750,0,0">
<attached>
<Model mesh="Goomba.mesh" position="0,0,21" scale=6 pitch=90/>
</attached>
<collisionShapes>
- <BoxCollisionShape position="0,0,80" halfExtents="10,10,10" />
+ <BoxCollisionShape position="0,0,20" halfExtents="10,10,6" />
</collisionShapes>
- </SOBGumba>
+ </SOBGumbaBoss>
+x
-
<!--CollisionShape for Gumba-->
<StaticEntity collisionType="static">
<collisionShapes>
Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.cc 2017-12-04 14:29:13 UTC (rev 11628)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.cc 2017-12-04 14:36:20 UTC (rev 11629)
@@ -59,6 +59,7 @@
lastPos_.x -= 20;
changeAllowed_ = true;
changedOn_ = 0.0;
+ creator_ = nullptr;
}
@@ -90,8 +91,18 @@
figure_ = newFigure;
}
+ void SOBGumba::setDirection(const bool direction)
+ {
+ if(direction)
+ {
+ goesRight_=true;
+ }
+ else
+ {
+ goesRight_=false;
+ }
+ }
-
void SOBGumba::tick(float dt)
{
SUPER(SOBGumba, tick, dt);
Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.h
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.h 2017-12-04 14:29:13 UTC (rev 11628)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.h 2017-12-04 14:36:20 UTC (rev 11629)
@@ -50,6 +50,7 @@
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
virtual void tick(float dt) override;
+ void setDirection(const bool direction);
bool attachedToFigure_;
@@ -67,6 +68,7 @@
Vector3 lastPos_;
bool changeAllowed_;
float changedOn_;
+ SOBGumbaBoss* creator_;
};
}
Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc 2017-12-04 14:29:13 UTC (rev 11628)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc 2017-12-04 14:36:20 UTC (rev 11629)
@@ -53,13 +53,12 @@
{
RegisterObject(SOBGumbaBoss);
- gumbaMaxTime_ = 5;
+ gumbaMaxTime_ = 4;
gumbaTime_ = 0;
+ maxGumbas = 10; //Max Gumbas spawnable by a Boss
}
-
-
bool SOBGumbaBoss::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
@@ -92,7 +91,7 @@
gumbaTime_ += dt;
if(gumbaTime_ > gumbaMaxTime_){
- spawnFireball();
+ spawnGumba();
gumbaTime_ = 0;
}
@@ -108,32 +107,33 @@
lastPos_ = getPosition();
}
- void SOBGumbaBoss::spawnFireball() {
+ void SOBGumbaBoss::spawnGumba() {
SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
- SOBFireball* ball = new SOBFireball(center_->getContext());
+ SOBGumba* gumba = new SOBGumba(center_->getContext());
Vector3 spawnpos = this->getWorldPosition();
spawnpos.z += 0;
- if (ball != nullptr && center_ != nullptr)
+ if (gumba != nullptr && center_ != nullptr)
{
- ball->addTemplate("fireball");
+ gumba->addTemplate("gumbaShootable");
bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6));
- ball->setDirection(direction);
+ gumba->setDirection(direction);
if(direction)
{
- spawnpos.x+=10;
+ spawnpos.x+=20;
}
else
{
- spawnpos.x-=10;
+ spawnpos.x-=20;
}
- ball->setPosition(spawnpos);
+ spawnpos.z+=15;
+ gumba->setPosition(spawnpos);
}
- Vector3 velocity = ball->getVelocity();
+ Vector3 velocity = gumba->getVelocity();
velocity.z -= 100;
- ball->setVelocity(velocity);
+ gumba->setVelocity(velocity);
}
}
Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h 2017-12-04 14:29:13 UTC (rev 11628)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h 2017-12-04 14:36:20 UTC (rev 11629)
@@ -49,12 +49,14 @@
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
virtual void tick(float dt) override;
- void spawnFireball();
+ void spawnGumba();
protected:
float gumbaTime_;
float gumbaMaxTime_;
+ int maxGumbas;
+
};
}
More information about the Orxonox-commit
mailing list