- Timestamp:
- Sep 15, 2015, 2:20:34 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFabien/src/modules/towerdefense/TDCoordinate.cc
r10258 r10586 8 8 namespace orxonox 9 9 { 10 //RegisterClass(TDCoordinate);11 12 10 /** 13 11 @brief 14 Constructor. Registers and initializes the object.12 Constructor. Sets the default coordinates: (0,0) 15 13 */ 16 14 TDCoordinate::TDCoordinate() 17 15 { 18 //RegisterObject(TDCoordinate); 19 x=0; 20 y=0; 21 16 Set(0,0); 22 17 } 23 18 24 19 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; 28 61 } 29 62 … … 34 67 35 68 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; 39 72 40 73 return *coord;
Note: See TracChangeset
for help on using the changeset viewer.