Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 19, 2007, 5:04:07 AM (16 years ago)
Author:
landauf
Message:
  • added very bad collision detection (presentation hack :D)
  • added explosions
  • fixed bug in ParticleInterface (it tried to delete SceneManager)

AND:

  • fixed one of the most amazing bugs ever! (the game crashed when I deleted an object through a timer-function. because the timer-functions is called by an iterator, the iterator indirectly delted its object. by overloading the (it++) operator, i was able to solve this problem)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/objects/Projectile.cc

    r644 r646  
    11#include "Projectile.h"
    22#include "../core/CoreIncludes.h"
     3#include "Explosion.h"
     4#include "Model.h"
    35
    46namespace orxonox
     
    3537    }
    3638
     39    void Projectile::tick(float dt)
     40    {
     41        WorldEntity::tick(dt);
     42
     43        float radius;
     44        for (Iterator<Model> it = ObjectList<Model>::start(); it; ++it)
     45        {
     46            if ((*it) != this->owner_)
     47            {
     48                radius = it->getScale().x * 3.0;
     49
     50                if (this->getPosition().squaredDistance(it->getPosition()) <= (radius*radius))
     51                {
     52                    Explosion* eplosion = new Explosion(this);
     53                    delete this;
     54                    return;
     55                }
     56            }
     57        }
     58    }
     59
    3760    void Projectile::destroyObject()
    3861    {
Note: See TracChangeset for help on using the changeset viewer.