- Timestamp:
- May 22, 2018, 1:04:40 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
r11978 r11979 117 117 if(this->ismoving){ 118 118 if(!(abs(this->actuelposition.z-target_z)<0.5)) { 119 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z) *2);119 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)); 120 120 move(dt, actuelposition, velocity); 121 121 } 122 122 if(!(abs(this->actuelposition.x-target_x)<0.5)){ 123 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x) *2,0,0);123 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0); 124 124 move(dt, actuelposition, velocity); 125 125 } … … 440 440 void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){ 441 441 if(!dontmove){ 442 this->setPosition(Vector3(actuelposition.x+ 20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt));443 if((abs(abs(velocity.x)- 2)<0.1) && (abs(velocity.z-0)<0.1))442 this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt)); 443 if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1)) 444 444 if(velocity.x<0){ 445 445 this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0))); … … 448 448 this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0))); 449 449 } 450 if((abs(abs(velocity.z)- 2)<0.1) && (abs(velocity.x-0)<0.1))450 if((abs(abs(velocity.z)-1)<0.1) && (abs(velocity.x-0)<0.1)) 451 451 if(velocity.z<0){ 452 452 this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0))); … … 485 485 486 486 void PacmanGhost::levelupvelo(){ 487 velocity.x = velocity.x + 2; 488 velocity.y = velocity.y + 2; 489 velocity.z = velocity.z + 2; 487 speed ++; 490 488 } 491 489 }
Note: See TracChangeset
for help on using the changeset viewer.