Changeset 1926 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jun 8, 2004, 7:41:44 PM (20 years ago)
- Location:
- orxonox/trunk/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/core/player.cc
r1924 r1926 78 78 shootLaser->addShootExt(xCor, yCor, zCor, .1, .4, .0); 79 79 shootLaser->addShootExt(xCor, yCor, zCor, -0.1, .4, .0); 80 shootRocket->addBackParable(xCor, yCor, zCor); 81 shootRocket->addSideAcc(xCor, yCor, zCor, RIGHT); 82 shootRocket->addSideAcc(xCor, yCor, zCor, LEFT); 80 shootRocket->addBackParable(xCor, yCor, zCor); 81 shootRocket->addSideAcc(xCor, yCor, zCor, RIGHT); 82 shootRocket->addSideAcc(xCor, yCor, zCor, LEFT); 83 shootRocket->addRotater(xCor, yCor, zCor); 83 84 //cout << "Player::shoot" << endl; 84 85 } -
orxonox/trunk/core/shoot_rocket.cc
r1925 r1926 31 31 step = 1.0; 32 32 inhibitor =0; 33 rotateAngle = 0.0; 33 34 } 34 35 … … 71 72 } 72 73 break; 74 75 case ROTATER: 76 // tmpShoot->xCor+=tmpShoot->xVel; 77 tmpShoot->yCor+=tmpShoot->yVel; 78 //tmpShoot->zCor+=tmpShoot->zVel; 79 //tmpShoot->xVel+=tmpShoot->xVel; 80 break; 81 73 82 } 74 83 75 84 glScalef(0.1, 0.1, 0.1); 76 85 glutWireCube(1.0); … … 134 143 void ShootRocket::addBackParable(float x, float y, float z) 135 144 { 136 inhibitor++; 137 if (inhibitor >= 10) 145 146 //cout << "ShootRocket::addShoot" << endl; 147 shoot* sh = new shoot; 148 sh->type = BACKPARABLE; 149 sh->xCor = x; sh->yCor = y; sh->zCor = z; 150 sh->xVel = (-1+(float)random() / 1000000000/step)/5; 151 sh->yVel = -.3; 152 sh->zVel = (1-(float)random() / 1000000000/step)/5; 153 sh->xAcc = 0; sh->yAcc = .01/step; sh->zAcc = 0; 154 sh->next = lastShoot; 155 lastShoot = sh; 156 inhibitor =0; 157 } 158 void ShootRocket::addSideAcc(float x, float y, float z, enum RocketDirection direction) 159 { 160 //cout << "ShootRocket::addShoot" << endl; 161 shoot* sh = new shoot; 162 sh->type = SIDEACC; 163 sh->xCor = x; sh->yCor = y; sh->zCor = z; 164 switch (direction) 138 165 { 139 //cout << "ShootRocket::addShoot" << endl; 140 shoot* sh = new shoot; 141 sh->type = BACKPARABLE; 142 sh->xCor = x; sh->yCor = y; sh->zCor = z; 143 sh->xVel = (-1+(float)random() / 1000000000/step)/5; 144 sh->yVel = -.3; 145 sh->zVel = (1-(float)random() / 1000000000/step)/5; 146 sh->xAcc = 0; sh->yAcc = .01/step; sh->zAcc = 0; 147 sh->next = lastShoot; 148 lastShoot = sh; 149 inhibitor =0; 166 case LEFT: 167 sh->xVel = -.5; sh->yVel = .05; sh->zVel = 0; 168 break; 169 case RIGHT: 170 sh->xVel = .5; sh->yVel = .05; sh->zVel = 0; 171 break; 150 172 } 151 } 152 void ShootRocket::addSideAcc(float x, float y, float z, enum RocketDirection direction) 153 { 154 inhibitor++; 155 if (inhibitor >= 10) 156 { 157 //cout << "ShootRocket::addShoot" << endl; 158 shoot* sh = new shoot; 159 sh->type = SIDEACC; 160 sh->xCor = x; sh->yCor = y; sh->zCor = z; 161 switch (direction) 162 { 163 case LEFT: 164 sh->xVel = -.5; sh->yVel = .05; sh->zVel = 0; 165 break; 166 case RIGHT: 167 sh->xVel = .5; sh->yVel = .05; sh->zVel = 0; 168 break; 169 } 170 sh->xAcc = .9; sh->yAcc = .02; sh->zAcc = 0; 171 sh->next = lastShoot; 172 lastShoot = sh; 173 inhibitor =0; 174 } 175 } 176 173 sh->xAcc = .9; sh->yAcc = .02; sh->zAcc = 0; 174 sh->next = lastShoot; 175 lastShoot = sh; 176 inhibitor =0; 177 178 } 179 void ShootRocket::addRotater(float x, float y, float z) 180 { 181 182 static float radius = 2; 183 rotateAngle+=.5; 184 //cout << "ShootRocket::addShoot" << endl; 185 shoot* sh = new shoot; 186 sh->type = ROTATER; 187 sh->xCor = x+radius*sin(rotateAngle); sh->yCor = y; sh->zCor = z+radius*cos(rotateAngle); 188 sh->xVel = .05*sin(rotateAngle); 189 sh->yVel = .4; 190 sh->xVel = .05*cos(rotateAngle); 191 sh->xAcc = 0; sh->yAcc = .01/step; sh->zAcc = 0; 192 sh->next = lastShoot; 193 lastShoot = sh; 194 inhibitor =0; 195 } 177 196 178 197 void ShootRocket::setShootStep(float step) -
orxonox/trunk/core/shoot_rocket.h
r1924 r1926 5 5 /* openGL Headers */ 6 6 #include <GL/glut.h> 7 #include <math.h> 7 8 8 9 #include "stdincl.h" … … 10 11 #include "npc.h" 11 12 12 enum RocketType { HOMING, SIDEACC, BACKPARABLE };13 enum RocketType { HOMING, SIDEACC, BACKPARABLE, ROTATER}; 13 14 enum RocketDirection {LEFT, RIGHT, UP, DOWN}; 14 15 … … 35 36 }; 36 37 shoot* lastShoot; 37 38 38 39 ShootRocket (); 39 40 ~ShootRocket (); 40 41 41 42 int inhibitor; 43 float rotateAngle; 42 44 43 45 void drawShoot(void); … … 45 47 void addBackParable(float x, float y, float z); 46 48 void addSideAcc(float x, float y, float z, enum RocketDirection direction); 49 void addRotater(float x, float y, float z); 50 47 51 void setShootStep(float step); 48 52 void removeShoot(shoot* sh);
Note: See TracChangeset
for help on using the changeset viewer.