-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoardinate.h
More file actions
84 lines (79 loc) · 1.68 KB
/
coardinate.h
File metadata and controls
84 lines (79 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
class cord //Holds the coardinates of the images
{
protected:
SDL_Rect cord_rect;
public:
cord(int x=0,int y=0,int w=0,int h=0)
{
cord_rect.x=x;
cord_rect.y=y;
cord_rect.w=w;
cord_rect.h=h;
}
int get_cord_x() //Returns the current x coardinate of the object...
{
return cord_rect.x;
}
int get_cord_y() //Returns the current y coardinate of the object...
{
return cord_rect.y;
}
int get_cord_w()
{
return cord_rect.w;
}
int get_cord_h()
{
return cord_rect.h;
}
SDL_Rect get_rect() //Returns rectangle and take width of the picture as a argument..
{
return cord_rect;
} //Sets the width and the height of the current picture..
};
class background:public cord
{
private:
public:
background()
{ }
background(int x,int y,int w,int h):cord(x,y,w,h)
{ }
void add_background_x(int n)
{
cord_rect.x+=(n-1);
if(cord_rect.x < -WIDTH)
cord_rect.x+=(2*WIDTH);
}
}
;
class wall:public cord
{
private:
bool state;
public:
wall()
{
state=false;
}
wall(int x,int y,int w,int h):cord(x,y,w,h)
{
state=false;
}
bool get_state()
{
return state;
}
void set_state(bool s)
{
state=s;
}
void add_wall_x(int n)
{
cord_rect.x+=n;
if( cord_rect.x>WIDTH or ( (cord_rect.x+cord_rect.w) < 0) )
state=false;
else
state=true;
}
};