Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 15, 2005, 2:32:27 AM (18 years ago)
Author:
bensch
Message:

orxonox/branches/world_entities: smoother aiming, and also displaying Distance (this is not too nice, but quite good to explain a few Things …

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/world_entities/src/world_entities/weapons/aim.cc

    r5560 r5567  
    2424#include "material.h"
    2525#include "t_animation.h"
     26#include "text.h"
    2627
    2728#include "world_entity.h"
     
    3334 * standart constructor
    3435 */
    35 Aim::Aim (const TiXmlElement* root)
     36Aim::Aim (PNode* source, const TiXmlElement* root)
    3637{
    3738  this->init();
     39
     40  this->source = source;
    3841
    3942  if (root)
     
    5053  if (this->material)
    5154    delete this->material;
     55
     56  if (this->text != NULL)
     57    delete this->text;
    5258}
    5359
     
    6672  this->setBindNode(this);
    6773  this->material = new Material;
     74  this->source = NULL;
    6875
    6976  this->anim = new tAnimation<Aim>(this, &Aim::setSize);
     
    7380  this->anim->addKeyFrame(50, .01, ANIM_LINEAR);
    7481
    75 }
    76 
     82  this->text = new Text();
     83  this->text->setParent2D(this);
     84  this->text->setRelCoor2D(10, -50);
     85  this->text->setParentMode2D(E2D_PARENT_MOVEMENT);
     86  this->text->setText("Testing");
     87}
    7788
    7889void Aim::loadParams(const TiXmlElement* root)
     
    101112      {
    102113        this->anim->replay();
    103         this->setParent(entity);
     114        this->setParentSoft(entity, 3);
    104115      }
    105116      delete iterator;
     
    141152  this->shiftDir2D(dt * rotationSpeed);
    142153
     154  char outputText[100];
     155  sprintf(outputText, "distance: %f\n", (this->source->getAbsCoor() - this->getAbsCoor()).len());
     156  this->text->setText(outputText);
    143157
    144158//   float z = 0.0f;
Note: See TracChangeset for help on using the changeset viewer.