[Orxonox-commit 7050] r11669 - in code/branches/Asteroid_HS17: data/levels src/modules/asteroids2D
vyang at orxonox.net
vyang at orxonox.net
Wed Dec 13 11:32:26 CET 2017
Author: vyang
Date: 2017-12-13 11:32:26 +0100 (Wed, 13 Dec 2017)
New Revision: 11669
Modified:
code/branches/Asteroid_HS17/data/levels/Asteroids2D.oxw
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DCenterPoint.cc
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.cc
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.h
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DPrereqs.h
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DStone.cc
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.cc
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.h
Log:
Kommentare
Modified: code/branches/Asteroid_HS17/data/levels/Asteroids2D.oxw
===================================================================
--- code/branches/Asteroid_HS17/data/levels/Asteroids2D.oxw 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/data/levels/Asteroids2D.oxw 2017-12-13 10:32:26 UTC (rev 11669)
@@ -1,6 +1,6 @@
<LevelInfo
name = "Asteroids2D"
- description = "Try to prevent asteroids from colliding into your spaceshuttle. Be prepared to dodge all asteroids or destroy them."
+ description = "Try to prevent asteroids from colliding into your spaceship. Be prepared to dodge all asteroids or destroy them."
tags = "minigame"
screenshot = "emptylevel.png"
/>
Modified: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc
===================================================================
--- code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc 2017-12-13 10:32:26 UTC (rev 11669)
@@ -34,12 +34,20 @@
TODO:
- Implement a counting system for the score
- - HUD can be improved (display health, points, level etc.)
- - Projectiles still fly in a mysterious direction
+ - HUD can be improved (display health, points, level etc.
- Problem: The asteroids spawn randomly on the playing field.
During spawn or level up, there is the possibility that they pawn at the position of the ship.
->spawn somewhere with a safty distance/radius
+ - look over collisionshapes of the stones -> sometimes collison with stone is not triggered for bigger stones
+ - modify parameters in data/levels/templates/spaceshipAsteroids2D.oxt for a better playing experience -> mass, damping, rotation etc.
+ IDEAS:
+ - make Asteroids more beautiful! (setting, ship, explosion particles, stones)
+ - particle effect after you got hit -> during bImmune is true
+ - implement shield -> object that can be triggered
+ - Projectiles should also move over the boarders and appear on the other side
+ -> they can also hurt the player
+
*/
#include "Asteroids2D.h"
Modified: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h
===================================================================
--- code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h 2017-12-13 10:32:26 UTC (rev 11669)
@@ -34,7 +34,6 @@
- Goal: Survive as long as you can, do not collide with stones
- spawns stones in every level up
- if you shoot and hit a stone, it will spit into two smaller stones
- -
@ingroup Asteroids2D
*/
@@ -55,7 +54,6 @@
#include "gamestates/GSLevel.h"
#include "chat/ChatManager.h"
-#include <vector>
// ! HACK
#include "infos/PlayerInfo.h"
@@ -108,6 +106,7 @@
int lives;
int multiplier;
+
private:
Modified: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DCenterPoint.cc
===================================================================
--- code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DCenterPoint.cc 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DCenterPoint.cc 2017-12-13 10:32:26 UTC (rev 11669)
@@ -50,6 +50,8 @@
this->width_ = 1043;
this->height_ = 646;
}
+
+
/**
@brief
Method to create a Asteroids2DCenterpoint through XML.
Modified: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.cc
===================================================================
--- code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.cc 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.cc 2017-12-13 10:32:26 UTC (rev 11669)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Florian Zinggeler
+ * Viviane Yang
*
*/
@@ -40,9 +40,7 @@
RegisterObject(Asteroids2DHUDinfo);
this->Asteroids2DGame = nullptr;
- //this->Ship = nullptr;
this->bShowPoints_ = true;
- this->bShowHealth_ = true;
}
void Asteroids2DHUDinfo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -76,24 +74,6 @@
}
}
- /*if(this->bShowHealth_)
- {
- const std::string& health = multi_cast<std::string>(this->Ship->getHealth());
- if (this->Asteroids2DGame->lives <= 0)
- {
- setTextSize(0.2);
- setPosition(Vector2(0.1, 0.02));
- this->setCaption("Final score:\n" + health);
- this->setColour(ColourValue(1, 0, 0, 1));
- }
- else
- {
- setTextSize(0.04);
- setPosition(Vector2(0.2, 0.02));
- this->setColour(ColourValue(1, 1, 1, 1));
- this->setCaption(health);
- }
- }*/
}
void Asteroids2DHUDinfo::changedOwner()
@@ -100,10 +80,10 @@
{
SUPER(Asteroids2DHUDinfo, changedOwner);
- if (this->getOwner() && this->getOwner()->getGametype())//&& this->getOwner->getPlayer())
+ if (this->getOwner() && this->getOwner()->getGametype())
{
this->Asteroids2DGame = orxonox_cast<Asteroids2D*>(this->getOwner()->getGametype());
- //this->Ship = orxonox_cast<Asteroids2DShip*>(this->getOwner()->getPlayer());
+
}
else
{
Modified: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.h
===================================================================
--- code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.h 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.h 2017-12-13 10:32:26 UTC (rev 11669)
@@ -20,7 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Florian Zinggeler
+ * Viviane Yang
+ *
+ * TODO: - get information for lives and level from gametype
+ * - implement it as you did for points
*
*/
@@ -52,19 +55,14 @@
inline bool getShowPoints() const
{ return this->bShowPoints_; }
- inline void setShowHealth(bool value)
- { this->bShowHealth_ = value; }
- inline bool getShowHealth() const
- { return this->bShowHealth_; }
-
private:
Asteroids2D* Asteroids2DGame;
bool bShowLives_;
bool bShowLevel_;
bool bShowPoints_;
- bool bShowHealth_;
+
};
}
#endif /* _Asteroids2DHUDinfo_H__ */
Modified: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DPrereqs.h
===================================================================
--- code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DPrereqs.h 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DPrereqs.h 2017-12-13 10:32:26 UTC (rev 11669)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Florian Zinggeler
+ * Viviane Yang
* Co-authors:
* ...
*
Modified: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DStone.cc
===================================================================
--- code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DStone.cc 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DStone.cc 2017-12-13 10:32:26 UTC (rev 11669)
@@ -119,10 +119,10 @@
void Asteroids2DStone::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
{
+ if (getGame() && orxonox_cast<Asteroids2DShip*>(originator) != nullptr)
+ getGame()->addPoints(100);
split();
//Pawn::damage(damage, healthdamage, shielddamage, originator, cs);
- if (getGame() && orxonox_cast<Asteroids2DShip*>(originator) != nullptr && getHealth() <= 0)
- getGame()->addPoints(3*42);
}
Asteroids2D* Asteroids2DStone::getGame()
Modified: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.cc
===================================================================
--- code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.cc 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.cc 2017-12-13 10:32:26 UTC (rev 11669)
@@ -90,15 +90,15 @@
projectile->attach(model);
model->setScale(5);
- this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
+ //get position and orientation of the ship to know in which direction the projectile needs to fire off
+ Pawn* player = this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn();
- projectile->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getOrientation());
- projectile->setPosition(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getPosition());
+ projectile->setOrientation(player->getOrientation());
+ projectile->setPosition(player->getPosition());
- //auf 2D Ebene druecken
- Vector3 muzzle2D = this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getOrientation()* WorldEntity::FRONT;
+ //Velocity & position of the projectile must be y = 0 since the game takes place in the x-z plane
+ Vector3 muzzle2D = player->getOrientation()* WorldEntity::FRONT ;
muzzle2D.y = 0;
-
projectile->setVelocity(muzzle2D * this->speed_);
projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
Modified: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.h
===================================================================
--- code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.h 2017-12-13 08:21:25 UTC (rev 11668)
+++ code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.h 2017-12-13 10:32:26 UTC (rev 11669)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Florian Zinggeler
+ * Viviane Yang
* Co-authors:
* ...
*
@@ -52,7 +52,7 @@
protected:
- virtual void shot() override;
+ virtual void shot() override; //2D movement
WeakPtr<Projectile> projectile;
WeakPtr<Asteroids2D> game;
};
More information about the Orxonox-commit
mailing list