-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOn_Screen_BG_Object.cpp
More file actions
158 lines (128 loc) · 3.61 KB
/
On_Screen_BG_Object.cpp
File metadata and controls
158 lines (128 loc) · 3.61 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#include "Function.h"
On_Screen_BG_Object::On_Screen_BG_Object(int x, int y, int type)
{
//Decide
Alive_Key = true;
Render_Key = false;
Object_Type = ON_SCREEN_BG;
Type = type;
Variable_Setter();
Target_X = x;
Target_Y = y;
Screen_Object.x = Target_X;
Screen_Object.y = Target_Y;
Screen_Object.w = 0;
Screen_Object.h = 0;
Friction = 0;
Degree = 0;
Magnitude = 0;
X_Vel = 0;
Y_Vel = 0;
Button = 0;
}
void On_Screen_BG_Object::Variable_Setter()
{
switch (Type)
{
case BLACK_BG: Game_Stat = SAVE_MENU;
Gravity_Physics = STATIC_G;
break;
}
}
void On_Screen_BG_Object::Variable_Setter_Bool_Conditional(int condition, bool condition2 )
{
switch (condition)
{
case 0: Render_Key = condition2;
}
}
void On_Screen_BG_Object::Soul_Input()
{
if (Game_Mode == SAVE_MENU)
{
if (Type == TARGET_REDICAL )
{
switch (Button)
{
case NO_KEY: Magnitude -= 5.0; X_Vel = cos(Degree * DEG) * Magnitude;
Y_Vel = -sin(Degree * DEG) * Magnitude;
if(Magnitude < 0) {Magnitude = 0; X_Vel = 0; Y_Vel = 0;}
break;
case UP: Degree = 90.0; Magnitude = 50;
X_Vel = cos(Degree * DEG) * Magnitude;
Y_Vel = -sin(Degree * DEG) * Magnitude;
break;
case UP_LEFT: Degree = 135.0; Magnitude = 50;
X_Vel = cos(Degree * DEG) * Magnitude;
Y_Vel = -sin(Degree * DEG) * Magnitude;
break;
case UP_RIGHT: Degree = 45.0; Magnitude = 50;
X_Vel = cos(Degree * DEG) * Magnitude;
Y_Vel = -sin(Degree * DEG) * Magnitude;
break;
case UP_DOWN: Magnitude -= Friction; if (Magnitude < 0) {Magnitude = 0;} X_Vel += 0; Y_Vel = 0;
break;
case DOWN: Degree = 270.0; Magnitude = 50;
X_Vel = cos(Degree * DEG) * Magnitude;
Y_Vel = -sin(Degree * DEG) * Magnitude;
break;
case DOWN_LEFT: Degree = 225.0; Magnitude = 50;
X_Vel = cos(Degree * DEG) * Magnitude;
Y_Vel = -sin(Degree * DEG) * Magnitude;
break;
case DOWN_RIGHT: Degree = 315.0; Magnitude = 50;
X_Vel = cos(Degree * DEG) * Magnitude;
Y_Vel = -sin(Degree * DEG) * Magnitude;
break;
case LEFT: Degree = 180.0; Magnitude = 50;
X_Vel = cos(Degree * DEG) * Magnitude;
Y_Vel = -sin(Degree * DEG) * Magnitude;
break;
case LEFT_RIGHT: Magnitude -= Friction; if (Magnitude < 0) {Magnitude = 0;} X_Vel += 0; Y_Vel = 0;
break;
case RIGHT: Degree = 0.0; Magnitude = 50;
X_Vel = cos(Degree * DEG) * Magnitude;
Y_Vel = -sin(Degree * DEG) * Magnitude;
break;
}
}
}
}
void On_Screen_BG_Object::Variable_Update(Uint32 deltaTicks)
{
Button = Button_Command();
Target_X += X_Vel *( deltaTicks / 1000.f );
Target_Y += Y_Vel *( deltaTicks / 1000.f );
if ((Target_X < 0)||(Target_X > SCREEN_WIDTH))
{Target_X -= X_Vel *( deltaTicks / 1000.f );}
if ((Target_Y < 0)||( Target_Y > SCREEN_HEIGHT))
{Target_Y -= Y_Vel *( deltaTicks / 1000.f );}
}
int On_Screen_BG_Object::Get_Type()
{
return Type;
}
int On_Screen_BG_Object::Get_Object_Type()
{
return Object_Type;
}
int On_Screen_BG_Object::Get_Gate_Type()
{
return Game_Stat;
}
bool On_Screen_BG_Object::Get_Alive_Key()
{
return Alive_Key;
}
bool On_Screen_BG_Object::Get_Render_Key()
{
return Render_Key;
}
int On_Screen_BG_Object::Get_Gravity_Physics()
{
return Gravity_Physics;
}
void On_Screen_BG_Object::Show()
{
Apply_Surface( Target_X, Target_Y, OnScreenBG, Screen, &Screen_Effects_Clips[Type] ) ;
}