Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 12:18:01 PM (9 years ago)
Author:
landauf
Message:

merged branch towerdefenseFS15

Location:
code/branches/presentationFS15merge
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationFS15merge

  • code/branches/presentationFS15merge/src/modules/towerdefense/TDCoordinate.cc

    r10258 r10615  
    1717    {
    1818        //RegisterObject(TDCoordinate);
    19         x=0;
    20         y=0;
     19        Set(0,0);
    2120
    2221    }
    2322
    2423    TDCoordinate::TDCoordinate(int x, int y)
    25     {
    26         this->x=x;
    27         this->y=y;
     24    {       
     25        Set(x,y);
     26    }
     27
     28    void TDCoordinate::Set(int x, int y)
     29    {       
     30        if (x < 0)
     31        {
     32            _x = 0;
     33        }
     34        else if (x > 15)
     35        {
     36            _x = 15;
     37        }
     38        else
     39        {
     40            _x = x;
     41        }
     42
     43        if (y < 0)
     44        {
     45            _y = 0;
     46        }
     47        else if (y > 15)
     48        {
     49            _y = 15;
     50        }
     51        else
     52        {
     53            _y = y;
     54        }
     55    }
     56
     57    int TDCoordinate::GetX()
     58    {       
     59        return _x;
     60    }
     61
     62    int TDCoordinate::GetY()
     63    {       
     64        return _y;
    2865    }
    2966
     
    3471
    3572        Vector3 *coord = new Vector3();
    36         coord->x= (x-8) * tileScale;
    37         coord->y= (y-8) * tileScale;
     73        coord->x= (_x-8) * tileScale;
     74        coord->y= (_y-8) * tileScale;
    3875        coord->z=100;
    3976
Note: See TracChangeset for help on using the changeset viewer.