Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/towerdefenseFabien/src/modules/towerdefense/TDCoordinate.cc @ 10586

Last change on this file since 10586 was 10586, checked in by fvultier, 9 years ago

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.

  • Property svn:eol-style set to native
File size: 1.1 KB
RevLine 
[10105]1#include "TDCoordinate.h"
2
3#include "towerdefense/TowerDefensePrereqs.h"
4
5
6
7
8namespace orxonox
9{
10    /**
11    @brief
[10586]12        Constructor. Sets the default coordinates: (0,0)
[10105]13    */
14    TDCoordinate::TDCoordinate()
15    {
[10586]16        Set(0,0);
[10105]17    }
18
19    TDCoordinate::TDCoordinate(int x, int y)
[10586]20    {       
21        Set(x,y);
[10105]22    }
23
[10586]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        }
[10105]38
[10586]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;
61    }
62
63
[10105]64    Vector3 TDCoordinate::get3dcoordinate()
65    {
[10246]66        float tileScale = 100;
[10105]67
[10246]68        Vector3 *coord = new Vector3();
[10586]69        coord->x= (_x-8) * tileScale;
70        coord->y= (_y-8) * tileScale;
71        coord->z=0;
[10105]72
[10246]73        return *coord;
[10105]74    }
75}
Note: See TracBrowser for help on using the repository browser.