- Timestamp:
- Apr 26, 2018, 4:11:19 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
r11898 r11915 38 38 namespace orxonox 39 39 { 40 Register UnloadableClass(Pacman);40 RegisterClass(Pacman); 41 41 42 42 Pacman::Pacman(Context* context) : Deathmatch(context) … … 44 44 RegisterObject(Pacman); 45 45 46 lives = 3;46 lives = 10; 47 47 point = 0; 48 48 level = 1; … … 57 57 58 58 PacmanGhost* ghosts[4]; 59 PacmanPointSphere* spheres[1];60 59 61 60 62 61 void Pacman::tick(float dt) 63 62 { 63 SUPER(Pacman, tick, dt); 64 64 65 int i = 0; 65 66 for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){ … … 74 75 } 75 76 77 76 78 bcolli = false; 77 79 for(int nrghost = 0; (nrghost<3) && (!bcolli); ++nrghost){ 78 80 bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition); 81 //orxout() << "GHOST" << nrghost << ghosts[nrghost]->getPosition() << endl; 79 82 } 83 80 84 if(bcolli){ 81 85 this->catched(); 82 86 } 83 87 … … 89 93 } 90 94 91 SUPER(Pacman, tick, dt);92 93 95 } 94 96 95 97 96 98 bool Pacman::collis(Vector3 one, Vector3 other){ 97 if((abs(one.x-other.x)< 0.1) && (abs(one.x-other.x)<0.1) && (abs(one.x-other.x)<0.1))99 if((abs(one.x-other.x)<7) && (abs(one.y-other.y)<7) && (abs(one.z-other.z)<7)) 98 100 return true; 99 101 return false; … … 107 109 108 110 void Pacman::posreset(){ 109 int i = 0;110 111 for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){ 111 112 nextghost->resetGhost(); 112 i++;113 113 } 114 114 player->setPosition(startposplayer); … … 118 118 ++point; 119 119 if(point == totallevelpoint) this->levelUp(); 120 121 120 Vector3 postaken = taken->getPosition(); 122 121 postaken.y = -50; … … 141 140 void Pacman::start() 142 141 { 143 orxout() << "start" << endl;144 145 142 Deathmatch::start(); 146 }147 148 void Pacman::playerPreSpawn(PlayerInfo* player)149 {150 //PlayerInfo* playerInfo_;151 //this->playerInfo_ = player;152 if(lives <= 0)153 {154 this->end();155 }156 143 } 157 144
Note: See TracChangeset
for help on using the changeset viewer.