[Orxonox-commit 7253] r11868 - code/branches/3DPacman_FS18/src/modules/Pacman
dreherm at orxonox.net
dreherm at orxonox.net
Mon Apr 16 23:37:28 CEST 2018
Author: dreherm
Date: 2018-04-16 23:37:28 +0200 (Mon, 16 Apr 2018)
New Revision: 11868
Added:
code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.cc
code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.h
Removed:
code/branches/3DPacman_FS18/src/modules/Pacman/3DPacman.cc
code/branches/3DPacman_FS18/src/modules/Pacman/3DPacman.h
Modified:
code/branches/3DPacman_FS18/src/modules/Pacman/CMakeLists.txt
Log:
Tes Game 3
Deleted: code/branches/3DPacman_FS18/src/modules/Pacman/3DPacman.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/Pacman/3DPacman.cc 2018-04-16 21:25:07 UTC (rev 11867)
+++ code/branches/3DPacman_FS18/src/modules/Pacman/3DPacman.cc 2018-04-16 21:37:28 UTC (rev 11868)
@@ -1,166 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Florian Zinggeler
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file 3DPacman.cc
- @brief Implementation of the 3DPacman class.
-*/
-
-#include "3DPacman.h"
-#include "core/CoreIncludes.h"
-#include "PacmanGelb.h"
-#include "PacmanGhost.h"
-#include "PacmanPointSphere.h"
-
-namespace orxonox
-{
- RegisterUnloadableClass(3DPacman);
-
- 3DPacman::3DPacman(Context* context) : Deathmatch(context)
- {
- RegisterObject(3DPacman);
-
- lives = 3;
- point = 0:
- level = 1;
- Vector3 startposplayer = Vector3(0,10,245);
-
- }
-
- void 3DPacman::levelUp()
- {
- this->end();
- }
-
-
- PacmanGhost[4] ghosts;
- PacmanPointSphere[1] spheres;
-
-
- void 3DPacman::tick(float dt)
- {
- int i = 0;
- for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
- ghosts[i] = nextghost;
- i++;
- }
-
- player = this->getPlayer();
- if (player != nullptr)
- {
- currentPosition = player->getWorldPosition();
- }
-
- bool bcolli = false;
- for(int nrghost = 0, (nrghost<3) && (!bcolli), ++nrghost){
- bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition)
- }
- if(collis){
- this->catched();
- }
-
- i = 0;
- for(PacmanPointSphere* nextsphere : ObjectList<PacmanPointSphere>()){
- if(collis(nextsphere.getPosition(), currentPosition)){
- takePoint(nextsphere);
- }
- }
-
- SUPER(3DPacman, tick, dt);
-
- }
-
-
- bool 3DPacman::collis(Vector3 one, Vector3 other){
- if((abs(one.x-other.x)<0.1) && (abs(one.x-other.x)<0.1) && (abs(one.x-other.x)<0.1))
- return true;
- return false;
- }
-
- void 3DPacman::catched(){
- if(!lives) this->end();
- --lives;
- this->posreset();
- }
-
- void 3DPacman::posreset(){
- int i = 0;
- for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
- nextghost.resetGhost();
- i++;
- }
- player.setPosition(startposplayer);
- }
-
- void 3DPacman::takePoint(PacmanPointSphere* taken){
- ++point;
- if(point == totallevelpoint) this->levelUp;
-
- Vector3 postaken = taken.getPosition();
- postaken.y = -50;
- taken.setPosition(postaken);
- }
-
-
- PacmanGelb* 3DPacman::getPlayer()
- {
- for (PacmanGelb* ship : ObjectList<PacmanGelb>())
- {
- return ship;
- }
- return nullptr;
- }
-
-
- void 3DPacman::start()
- {
- orxout() << "start" << endl;
-
- Deathmatch::start();
- }
-
- void 3DPacman::playerPreSpawn(PlayerInfo* player)
- {
- this->playerInfo_ = player;
- if(lives <= 0)
- {
- this->end();
- }
- }
-
-
- void 3DPacman::end()
- {
- if (Highscore::exists())
- {
- int score = this->getPoints();
- Highscore::getInstance().storeScore("3DPacman", score, this->playerInfo_);
- }
- GSLevel::startMainMenu();
- }
-}
Deleted: code/branches/3DPacman_FS18/src/modules/Pacman/3DPacman.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/Pacman/3DPacman.h 2018-04-16 21:25:07 UTC (rev 11867)
+++ code/branches/3DPacman_FS18/src/modules/Pacman/3DPacman.h 2018-04-16 21:37:28 UTC (rev 11868)
@@ -1,146 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Florian Zinggeler
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DodgeRace.h
- @brief Gametype.
- @ingroup DodgeRace
-*/
-
-#ifndef _3DPacman_H__
-#define _3DPacman_H__
-
-#include "PacmanGelb.h"
-
-
-#include "core/EventIncludes.h"
-#include "core/command/Executor.h"
-#include "core/config/ConfigValueIncludes.h"
-
-#include "gamestates/GSLevel.h"
-#include "chat/ChatManager.h"
-#include <vector>
-
-// ! HACK
-#include "infos/PlayerInfo.h"
-
-#include "core/command/ConsoleCommand.h"
-
-#include "gametypes/Deathmatch.h"
-#include "tools/Timer.h"
-
-namespace orxonox
-{
-
- class _3DPacmanExport 3DPacman : public Deathmatch
- {
- public:
- 3DPacman(Context* context);
-
- virtual void start() override;
- virtual void end() override;
-
- virtual void tick(float dt) override;
-
- virtual void playerPreSpawn(PlayerInfo* player) override;
-
- void levelUp();
-
- int getLives(){return this->lives;}
- int getLevel(){return this->level;}
- int getPoints(){return this->point;}
- int getMultiplier(){return this->multiplier;}
-
- void setCenterpoint(DodgeRaceCenterPoint* center)
- { this->center_ = center; }
- virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
-
- // checks if multiplier should be reset.
- void comboControll();
- void costLife();
-
- bool bEndGame;
- bool bShowLevel;
- int lives;
- int multiplier;
- float counter;
- int pattern;
- float currentPosition;
- float lastPosition;
-
- private:
- PacmanGelb* player;
- PacmanGhost[]
- Vector3 currentPosition;
-
-
-
- Timer endGameTimer;
-
- DodgeRaceShip* getPlayer();
- WeakPtr<PlayerInfo> playerInfo_;
- std::vector<DodgeRaceCube*> cubeList;
- void toggleShowLevel(){bShowLevel = !bShowLevel;}
- void addPoints(int numPoints);
-
- WeakPtr<DodgeRaceCenterPoint> center_;
- int level;
- int point;
- bool b_combo;
-
- Timer enemySpawnTimer;
- Timer comboTimer;
- Timer showLevelTimer;
-
-
- /*
-
- //void spawnEnemy();
-
-
-
-
-
-
-
-
-
-
-
-
- private:
-
-
-
-
- //Context* context;
- */
- };
-}
-
-#endif /* _DodgeRace_H__ */
Modified: code/branches/3DPacman_FS18/src/modules/Pacman/CMakeLists.txt
===================================================================
--- code/branches/3DPacman_FS18/src/modules/Pacman/CMakeLists.txt 2018-04-16 21:25:07 UTC (rev 11867)
+++ code/branches/3DPacman_FS18/src/modules/Pacman/CMakeLists.txt 2018-04-16 21:37:28 UTC (rev 11868)
@@ -1,6 +1,6 @@
SET_SOURCE_FILES(PICKUP_SRC_FILES
- 3DPacman.cc
+ Pacman.cc
PacmanGhost.cc
PacmanGelb.cc
PacmanPointSphere.cc
Added: code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.cc (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.cc 2018-04-16 21:37:28 UTC (rev 11868)
@@ -0,0 +1,166 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file 3DPacman.cc
+ @brief Implementation of the 3DPacman class.
+*/
+
+#include "Pacman.h"
+#include "core/CoreIncludes.h"
+#include "PacmanGelb.h"
+#include "PacmanGhost.h"
+#include "PacmanPointSphere.h"
+
+namespace orxonox
+{
+ RegisterUnloadableClass(Pacman);
+
+ Pacman::Pacman(Context* context) : Deathmatch(context)
+ {
+ RegisterObject(Pacman);
+
+ lives = 3;
+ point = 0:
+ level = 1;
+ Vector3 startposplayer = Vector3(0,10,245);
+
+ }
+
+ void Pacman::levelUp()
+ {
+ this->end();
+ }
+
+
+ PacmanGhost[4] ghosts;
+ PacmanPointSphere[1] spheres;
+
+
+ void Pacman::tick(float dt)
+ {
+ int i = 0;
+ for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
+ ghosts[i] = nextghost;
+ i++;
+ }
+
+ player = this->getPlayer();
+ if (player != nullptr)
+ {
+ currentPosition = player->getWorldPosition();
+ }
+
+ bool bcolli = false;
+ for(int nrghost = 0, (nrghost<3) && (!bcolli), ++nrghost){
+ bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition)
+ }
+ if(collis){
+ this->catched();
+ }
+
+ i = 0;
+ for(PacmanPointSphere* nextsphere : ObjectList<PacmanPointSphere>()){
+ if(collis(nextsphere.getPosition(), currentPosition)){
+ takePoint(nextsphere);
+ }
+ }
+
+ SUPER(Pacman, tick, dt);
+
+ }
+
+
+ bool Pacman::collis(Vector3 one, Vector3 other){
+ if((abs(one.x-other.x)<0.1) && (abs(one.x-other.x)<0.1) && (abs(one.x-other.x)<0.1))
+ return true;
+ return false;
+ }
+
+ void Pacman::catched(){
+ if(!lives) this->end();
+ --lives;
+ this->posreset();
+ }
+
+ void Pacman::posreset(){
+ int i = 0;
+ for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
+ nextghost.resetGhost();
+ i++;
+ }
+ player.setPosition(startposplayer);
+ }
+
+ void Pacman::takePoint(PacmanPointSphere* taken){
+ ++point;
+ if(point == totallevelpoint) this->levelUp;
+
+ Vector3 postaken = taken.getPosition();
+ postaken.y = -50;
+ taken.setPosition(postaken);
+ }
+
+
+ PacmanGelb* Pacman::getPlayer()
+ {
+ for (PacmanGelb* ship : ObjectList<PacmanGelb>())
+ {
+ return ship;
+ }
+ return nullptr;
+ }
+
+
+ void Pacman::start()
+ {
+ orxout() << "start" << endl;
+
+ Deathmatch::start();
+ }
+
+ void Pacman::playerPreSpawn(PlayerInfo* player)
+ {
+ this->playerInfo_ = player;
+ if(lives <= 0)
+ {
+ this->end();
+ }
+ }
+
+
+ void Pacman::end()
+ {
+ if (Highscore::exists())
+ {
+ int score = this->getPoints();
+ Highscore::getInstance().storeScore("3DPacman", score, this->playerInfo_);
+ }
+ GSLevel::startMainMenu();
+ }
+}
Property changes on: code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.cc
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.h (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.h 2018-04-16 21:37:28 UTC (rev 11868)
@@ -0,0 +1,133 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DodgeRace.h
+ @brief Gametype.
+ @ingroup DodgeRace
+*/
+
+#ifndef _Pacman_H__
+#define _Pacman_H__
+
+#include "PacmanGelb.h"
+
+
+#include "core/EventIncludes.h"
+#include "core/command/Executor.h"
+#include "core/config/ConfigValueIncludes.h"
+
+#include "gamestates/GSLevel.h"
+#include "chat/ChatManager.h"
+#include <vector>
+
+// ! HACK
+#include "infos/PlayerInfo.h"
+
+#include "core/command/ConsoleCommand.h"
+
+#include "gametypes/Deathmatch.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+
+ class _PacmanExport Pacman : public Deathmatch
+ {
+ public:
+ Pacman(Context* context);
+
+ virtual void start() override;
+ virtual void end() override;
+
+ virtual void tick(float dt) override;
+
+ virtual void playerPreSpawn(PlayerInfo* player) override;
+
+ void levelUp();
+ bool collis(Vector3 one, Vector3 other);
+ void catched();
+ void posreset();
+ void takePoint();
+ void getPlayer();
+
+
+ bool bEndGame;
+ bool bShowLevel;
+ int lives;
+ int multiplier;
+ float counter;
+ int pattern;
+ float currentPosition;
+ float lastPosition;
+
+ private:
+ PacmanGelb* player;
+ PacmanGhost[]
+ Vector3 currentPosition;
+
+
+ Timer endGameTimer;
+ WeakPtr<PlayerInfo> playerInfo_;
+
+ WeakPtr<DodgeRaceCenterPoint> center_;
+ int level;
+ int point;
+ bool b_combo;
+
+ Timer enemySpawnTimer;
+ Timer comboTimer;
+ Timer showLevelTimer;
+
+
+ /*
+
+ //void spawnEnemy();
+
+
+
+
+
+
+
+
+
+
+
+
+ private:
+
+
+
+
+ //Context* context;
+ */
+ };
+}
+
+#endif /* _DodgeRace_H__ */
Property changes on: code/branches/3DPacman_FS18/src/modules/Pacman/Pacman.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
More information about the Orxonox-commit
mailing list