Changeset 1924 in orxonox.OLD
- Timestamp:
- Jun 8, 2004, 6:30:23 PM (20 years ago)
- Location:
- orxonox/trunk/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/core/player.cc
r1920 r1924 78 78 shootLaser->addShootExt(xCor, yCor, zCor, .1, .4, .0); 79 79 shootLaser->addShootExt(xCor, yCor, zCor, -0.1, .4, .0); 80 shootRocket->addShoot(xCor, yCor, zCor); 80 shootRocket->addBackParable(xCor, yCor, zCor); 81 shootRocket->addSideAcc(xCor, yCor, zCor, RIGHT); 82 shootRocket->addSideAcc(xCor, yCor, zCor, LEFT); 81 83 //cout << "Player::shoot" << endl; 82 84 } -
orxonox/trunk/core/shoot_rocket.cc
r1921 r1924 48 48 glPushMatrix(); 49 49 glTranslatef(tmpShoot->xCor, tmpShoot->yCor, tmpShoot->zCor); 50 tmpShoot->xCor+=tmpShoot->xVel; 51 tmpShoot->yCor+=tmpShoot->yVel; 52 tmpShoot->xVel+=tmpShoot->xAcc; 53 tmpShoot->yVel+=tmpShoot->yAcc; 54 50 switch (tmpShoot->type) 51 { 52 case BACKPARABLE: 53 tmpShoot->xCor+=tmpShoot->xVel; 54 tmpShoot->yCor+=tmpShoot->yVel; 55 tmpShoot->xVel+=tmpShoot->xAcc; 56 tmpShoot->yVel+=tmpShoot->yAcc; 57 break; 58 59 case SIDEACC: 60 if (tmpShoot->xVel >= .01 || tmpShoot->xVel <= -.01) 61 { 62 tmpShoot->xCor+=tmpShoot->xVel; 63 tmpShoot->xVel*=tmpShoot->xAcc; 64 } 65 else 66 { 67 tmpShoot->yCor+=tmpShoot->yVel; 68 tmpShoot->yVel+=tmpShoot->yVel*tmpShoot->yAcc; 69 } 70 break; 71 } 72 55 73 glScalef(0.1, 0.1, 0.1); 56 74 glutWireCube(1.0); … … 112 130 } 113 131 114 void ShootRocket::add Shoot(float x, float y, float z)132 void ShootRocket::addBackParable(float x, float y, float z) 115 133 { 116 134 inhibitor++; … … 119 137 //cout << "ShootRocket::addShoot" << endl; 120 138 shoot* sh = new shoot; 139 sh->type = BACKPARABLE; 121 140 sh->xCor = x; sh->yCor = y; sh->zCor = z; 122 141 sh->xVel = (-1+(float)random() / 1000000000/step)/5; … … 129 148 } 130 149 } 150 void ShootRocket::addSideAcc(float x, float y, float z, enum RocketDirection direction) 151 { 152 inhibitor++; 153 if (inhibitor >= 10) 154 { 155 //cout << "ShootRocket::addShoot" << endl; 156 shoot* sh = new shoot; 157 sh->type = SIDEACC; 158 sh->xCor = x; sh->yCor = y; sh->zCor = z; 159 switch (direction) 160 { 161 case LEFT: 162 sh->xVel = -.3; sh->yVel = .05; sh->zVel = 0; 163 cout << "Left\n"; 164 break; 165 case RIGHT: 166 sh->xVel = .3; sh->yVel = .05; sh->zVel = 0; 167 break; 168 } 169 sh->xAcc = .9; sh->yAcc = .02; sh->zAcc = 0; 170 sh->next = lastShoot; 171 lastShoot = sh; 172 inhibitor =0; 173 } 174 } 131 175 132 void ShootRocket::addShootExt(float x, float y, float z,133 float xVel, float yVel, float zVel)134 {135 //cout << "ShootRocket::addShootExtended" << endl;136 shoot* sh = new shoot;137 sh->xCor = x; sh->yCor = y; sh->zCor = z;138 sh->xVel = xVel/step; sh->yVel = yVel/step; sh->zVel = zVel/step;139 sh->xAcc = 0; sh->yAcc = .02; sh->zAcc = 0;140 sh->next = lastShoot;141 lastShoot = sh;142 }143 176 144 177 void ShootRocket::setShootStep(float step) -
orxonox/trunk/core/shoot_rocket.h
r1921 r1924 10 10 #include "npc.h" 11 11 12 enum RocketType { HOMING, SIDEACC, BACKPARABLE}; 13 enum RocketDirection {LEFT, RIGHT, UP, DOWN}; 14 12 15 class ShootRocket { 13 16 … … 17 20 /* a list of all shoot-amental objects */ 18 21 struct shoot { 22 enum RocketType type; 19 23 shoot *next; 20 24 float xCor; … … 39 43 void drawShoot(void); 40 44 void addShoot(shoot* sh); 41 void add Shoot(float x, float y, float z);42 void addS hootExt(float x, float y, float z, float xVel, float yVel, float zVel);45 void addBackParable(float x, float y, float z); 46 void addSideAcc(float x, float y, float z, enum RocketDirection direction); 43 47 void setShootStep(float step); 44 48 void removeShoot(shoot* sh);
Note: See TracChangeset
for help on using the changeset viewer.