Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 15, 2015, 2:20:34 PM (9 years ago)
Author:
fvultier
Message:

Removed unuses classes and templates. The enemies move now along a path defined in the XML level file and no more along a static hard coded path.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/towerdefenseFabien/src/modules/towerdefense/TDCoordinate.cc

    r10258 r10586  
    88namespace orxonox
    99{
    10     //RegisterClass(TDCoordinate);
    11 
    1210    /**
    1311    @brief
    14         Constructor. Registers and initializes the object.
     12        Constructor. Sets the default coordinates: (0,0)
    1513    */
    1614    TDCoordinate::TDCoordinate()
    1715    {
    18         //RegisterObject(TDCoordinate);
    19         x=0;
    20         y=0;
    21 
     16        Set(0,0);
    2217    }
    2318
    2419    TDCoordinate::TDCoordinate(int x, int y)
    25     {
    26         this->x=x;
    27         this->y=y;
     20    {       
     21        Set(x,y);
     22    }
     23
     24    void TDCoordinate::Set(int x, int y)
     25    {       
     26        if (x < 0)
     27        {
     28            _x = 0;
     29        }
     30        else if (x > 15)
     31        {
     32            _x = 15;
     33        }
     34        else
     35        {
     36            _x = x;
     37        }
     38
     39        if (y < 0)
     40        {
     41            _y = 0;
     42        }
     43        else if (y > 15)
     44        {
     45            _y = 15;
     46        }
     47        else
     48        {
     49            _y = y;
     50        }
     51    }
     52
     53    int TDCoordinate::GetX()
     54    {       
     55        return _x;
     56    }
     57
     58    int TDCoordinate::GetY()
     59    {       
     60        return _y;
    2861    }
    2962
     
    3467
    3568        Vector3 *coord = new Vector3();
    36         coord->x= (x-8) * tileScale;
    37         coord->y= (y-8) * tileScale;
    38         coord->z=100;
     69        coord->x= (_x-8) * tileScale;
     70        coord->y= (_y-8) * tileScale;
     71        coord->z=0;
    3972
    4073        return *coord;
Note: See TracChangeset for help on using the changeset viewer.