Changeset 6078 in orxonox.OLD for trunk/src/world_entities/weapons
- Timestamp:
- Dec 13, 2005, 2:55:08 AM (19 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/aim.cc
r6054 r6078 65 65 this->setClassID(CL_CROSSHAIR, "Aim"); 66 66 this->setName("Aim"); 67 68 this->addNodeModeFlags(PNODE_REPARENT_TO_NULLPARENT);69 67 70 68 this->setLayer(E2D_LAYER_TOP); -
trunk/src/world_entities/weapons/guided_missile.cc
r6074 r6078 150 150 { 151 151 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 152 if (t arget.getParent() != PNode::getNullParent())152 if (this->target != NULL && this->target->getParent() != PNode::getNullParent()) 153 153 { 154 velocity += ((target.getAbsCoor() - this->getAbsCoor()).getNormalized())*agility; 154 printf("========%s::%s\n", target->getParent()->getClassName(), target->getParent()->getName() ); 155 velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility; 155 156 float speed = velocity.len(); 156 157 if (speed > this->maxVelocity) -
trunk/src/world_entities/weapons/projectile.cc
r6074 r6078 37 37 this->lifeCycle = 0.0; 38 38 this->lifeSpan = 1.0f; /* sec */ 39 this->target.addNodeModeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | 40 PNODE_REPARENT_TO_NULLPARENT); 41 39 this->target = NULL; 42 40 this->removeNode(); 43 41 } … … 103 101 void Projectile::setTarget(PNode* target) 104 102 { 105 this->target.setParent(target); 103 if (this->target == NULL) 104 this->target = new PNode(target, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_ON_PARENTS_REMOVE); 105 else 106 this->target->setParent(target); 106 107 } 107 108 -
trunk/src/world_entities/weapons/projectile.h
r6056 r6078 60 60 Vector velocity; //!< velocity of the projectile. 61 61 62 PNode 62 PNode* target; //!< A target for guided Weapons. 63 63 }; 64 64
Note: See TracChangeset
for help on using the changeset viewer.