[Orxonox-commit 7773] r12365 - code/branches/3DPacman_FS19/src/modules/pacman
rueegseb at orxonox.net
rueegseb at orxonox.net
Thu May 9 16:24:20 CEST 2019
Author: rueegseb
Date: 2019-05-09 16:24:20 +0200 (Thu, 09 May 2019)
New Revision: 12365
Added:
code/branches/3DPacman_FS19/src/modules/pacman/PacmanLaser.cpp
code/branches/3DPacman_FS19/src/modules/pacman/PacmanLaser.h
Modified:
code/branches/3DPacman_FS19/src/modules/pacman/Pacman.cc
code/branches/3DPacman_FS19/src/modules/pacman/Pacman.h
code/branches/3DPacman_FS19/src/modules/pacman/PacmanPointSphere.cc
Log:
Laser boom boom
Modified: code/branches/3DPacman_FS19/src/modules/pacman/Pacman.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/Pacman.cc 2019-05-09 14:22:55 UTC (rev 12364)
+++ code/branches/3DPacman_FS19/src/modules/pacman/Pacman.cc 2019-05-09 14:24:20 UTC (rev 12365)
@@ -86,6 +86,23 @@
//Needed for gameover
if(deathtime != 0){
dead(dt);
+
+ if(point > 230){
+
+ for(PacmanPointSphere* pointer : ObjectList<PacmanPointSphere>()){
+ pointSpherePosition = pointer->getPosition();
+
+ if(pointSpherePosition.y > 0){
+ PacmanLaser* pos = ObjectList<PacmanLaser>(); //to do
+ pos->setPosition(pointSpherePosition);
+ break;
+ }
+
+
+ }
+
+ }
+
}
//ingame loop
@@ -93,7 +110,7 @@
//Register ghosts
int i = 0;
- for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
+ for(PacmanGhost* nextghost: ObjectList<PacmanGhost>()){
ghosts[i] = nextghost;
i++;
}
@@ -205,6 +222,7 @@
//Collision with PointSphere
void Pacman::takePoint(PacmanPointSphere* taken){
++point;
+ }
if(point == totallevelpoint){
this->levelUp();
return;
Modified: code/branches/3DPacman_FS19/src/modules/pacman/Pacman.h
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/Pacman.h 2019-05-09 14:22:55 UTC (rev 12364)
+++ code/branches/3DPacman_FS19/src/modules/pacman/Pacman.h 2019-05-09 14:24:20 UTC (rev 12365)
@@ -39,8 +39,8 @@
#include "PacmanGhost.h"
#include "PacmanPointSphere.h"
#include "PacmanPointAfraid.h"
+#include "PacmanLaser.h"
-
#include "core/EventIncludes.h"
#include "core/command/Executor.h"
#include "core/config/ConfigValueIncludes.h"
Added: code/branches/3DPacman_FS19/src/modules/pacman/PacmanLaser.cpp
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanLaser.cpp (rev 0)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanLaser.cpp 2019-05-09 14:24:20 UTC (rev 12365)
@@ -0,0 +1,51 @@
+#include "PacmanLaser.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+namespace orxonox
+{
+ RegisterClass(PacmanLaser);
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes some default values.
+ @param creator
+ The creator of this object.
+ */
+ PacmanLaser::PacmanLaser(Context* context) : ControllableEntity(context)
+ {
+ RegisterObject(PacmanPointSphere);
+ this->setCollisionType(CollisionType::None);
+ }
+
+ /**
+ @brief
+ Destructor. Destroys controller, if present.
+ */
+ PacmanLaser::~PacmanLaser()
+ {
+ // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
+ }
+
+ /**
+ @brief
+ Method for creating a AutonomousDrone through XML.
+ */
+ void PacmanPointSphere::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PacmanPointSphere, XMLPort, xmlelement, mode);
+ }
+
+
+ void PacmanLaser::tick(float dt)
+ {
+ SUPER(PacmanPointSphere, tick, dt);
+ }
+
+ void PacmanLaser::resetPacmanLaser(){
+ resetposition = this->getPosition();
+ resetposition.y = -50;
+ this->setPosition(resetposition);
+ }
+}
\ No newline at end of file
Added: code/branches/3DPacman_FS19/src/modules/pacman/PacmanLaser.h
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanLaser.h (rev 0)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanLaser.h 2019-05-09 14:24:20 UTC (rev 12365)
@@ -0,0 +1,31 @@
+#ifndef _PacmanLaser_H__
+#define _PacmanLaser_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/XMLPort.h"
+
+#include "worldentities/ControllableEntity.h"
+
+namespace orxonox {
+
+ class _OrxonoxExport PacmanLaser : public ControllableEntity
+ {
+ public:
+ PacmanLaser(Context* context);
+ virtual ~PacmanLaser();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
+ virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+
+
+ private:
+
+ Vector3 resetposition;
+
+ };
+
+}
+
+#endif
Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanPointSphere.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanPointSphere.cc 2019-05-09 14:22:55 UTC (rev 12364)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanPointSphere.cc 2019-05-09 14:24:20 UTC (rev 12365)
@@ -81,7 +81,11 @@
}
return false;
}
+ bool showLaserPointSphere = false;
+
+
+
//Reset position
void PacmanPointSphere::resetPacmanPointSphere(){
resetposition = this->getPosition();
More information about the Orxonox-commit
mailing list