Last change
on this file since 10487 was
10452,
checked in by maxima, 10 years ago
|
Towerdefense merged to Presentation
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | #include "TDCoordinate.h" |
---|
2 | |
---|
3 | #include "towerdefense/TowerDefensePrereqs.h" |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | namespace orxonox |
---|
9 | { |
---|
10 | //RegisterClass(TDCoordinate); |
---|
11 | |
---|
12 | /** |
---|
13 | @brief |
---|
14 | Constructor. Registers and initializes the object. |
---|
15 | */ |
---|
16 | TDCoordinate::TDCoordinate() |
---|
17 | { |
---|
18 | //RegisterObject(TDCoordinate); |
---|
19 | Set(0,0); |
---|
20 | |
---|
21 | } |
---|
22 | |
---|
23 | TDCoordinate::TDCoordinate(int x, int 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; |
---|
65 | } |
---|
66 | |
---|
67 | |
---|
68 | Vector3 TDCoordinate::get3dcoordinate() |
---|
69 | { |
---|
70 | float tileScale = 100; |
---|
71 | |
---|
72 | Vector3 *coord = new Vector3(); |
---|
73 | coord->x= (_x-8) * tileScale; |
---|
74 | coord->y= (_y-8) * tileScale; |
---|
75 | coord->z=100; |
---|
76 | |
---|
77 | return *coord; |
---|
78 | } |
---|
79 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.