Changeset 10286 in orxonox.OLD for branches/playability/src/world_entities/projectiles/spike_ball.cc
- Timestamp:
- Jan 17, 2007, 9:23:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/projectiles/spike_ball.cc
r10281 r10286 55 55 this->emitter->setEmissionVelocity(50.0); 56 56 57 // this->speed = 150;58 /*59 this->angle = 0;60 this->rotationSpeed = 130;*/61 57 this->setRotationSpeed(130); 62 58 … … 70 66 71 67 this->launcher = new Vector [this->getFragments()]; 72 73 // this->fastFactory = tFastFactory<Spike>::getFastFactory(CL_SPIKE, "Spike");74 75 /*76 this->weaponMan = new WeaponManager(dynamic_cast<WorldEntity*>(this));77 this->weaponMan->setParentEntity(this);78 this->weaponMan->setSlotCount(1);79 this->weaponMan->setSlotPosition(0, Vector(0, 0, 0));80 this->weaponMan->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);81 82 Weapon* cannon = new SpikeLauncher();83 cannon->setName( "SpikeLauncher");84 this->weaponMan->addWeapon(cannon, 0, 0);85 this->weaponMan->changeWeaponConfig(0);86 87 this->weaponMan->getWeapon(0)->increaseEnergy(50);*/88 68 } 89 69 … … 172 152 this->hitEntity = entity; 173 153 dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0); 174 // this->deactivate();175 154 } 176 155 … … 178 157 void SpikeBall::blow() 179 158 { 159 updateFireDir(); 160 180 161 Spike* pj = NULL; 181 /* printf( "KA-" );*/182 162 for ( int i = 0; i < this->getFragments(); i++) 183 163 { 184 164 pj = new Spike(); 185 165 assert( pj ); 186 /* printf(" %i", i);*/187 166 pj->setParent(PNode::getNullParent()); 188 167 … … 191 170 pj->setParent(PNode::getNullParent()); 192 171 pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size); 193 Quaternion q;194 pj->setAbsDir( q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));172 // Quaternion q; 173 pj->setAbsDir(Quaternion(this->launcher[i], 0)); 195 174 196 175 pj->toList(this->getOMListNumber()); 197 176 198 /*199 pj->setAbsCoor(this->getAbsCoor() + VECTOR_RAND(3));200 pj->setAbsDir(this->getAbsDir());*/201 177 pj->activate(); 202 178 } 203 /* printf( "BOOM\n" );*/204 179 } 205 180 … … 219 194 ca = cos (this->getAngle()); 220 195 sa = sin (this->getAngle()); 221 // final version below... easier to to cheat with the one above.222 196 223 197 m[0][0] = nx * nx * (1 - ca) + ca; … … 233 207 float x, y, z; 234 208 for (int i = 0; i < this->getFragments(); i++){ 235 // printf("%i ", i);236 209 x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z; 237 210 y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z; … … 240 213 this->launcher[i] = Vector (x, y, z); 241 214 } 242 // printf("\n");243 215 244 216 for( int i = 0; i < 3 ; i++) … … 254 226 void SpikeBall::tick (float dt) 255 227 { 256 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 257 Vector v = this->getVelocity() * dt; 228 Vector v = this->velocity * dt; 258 229 this->shiftCoor(v); 259 260 // if(this->lifeCycle > .9){261 // /* printf("time to blow: ");*/262 // // this->weaponMan->fire();263 // /* this->blow();*/264 // }265 230 266 231 if (this->tickLifeCycle(dt)){ … … 270 235 271 236 this->updateAngle( dt ); 272 // angle += rotationSpeed * dt;273 237 } 274 238 … … 289 253 { 290 254 glPushAttrib(GL_ENABLE_BIT); 291 //glDisable(GL_LIGHTING);292 293 255 glMatrixMode(GL_MODELVIEW); 294 256 glPushMatrix(); … … 305 267 306 268 glPopMatrix(); 307 308 269 glPopAttrib(); 309 270 }
Note: See TracChangeset
for help on using the changeset viewer.