-
Notifications
You must be signed in to change notification settings - Fork 0
/
Enemy.h
471 lines (419 loc) · 14.4 KB
/
Enemy.h
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
#pragma once
#include "GameObj.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------
//CEnemyクラス(全ての敵の基底クラス)
//----------------------------------------------------------------------
class CEnemy :public CGameObj
{
protected:
int m_anime, m_anime_count;
int m_frame_count,m_frame_count_laser;
int vitality;
int m_score;
int m_LockedID;
public:
// コンストラクタ、移動、描画
void* operator new(size_t t) { return operator_new(t, Game->EnemyList); }
void operator delete(void* p) { operator_delete(p, Game->EnemyList); }
CEnemy(float x, float y, float w, float h, float r, int vitality, int score);
virtual bool HitorNot();
int GetVitality()
{
return vitality;
}
void SetVitality(int vit)
{
vitality =vit;
}
void SubtractVital(int attack)
{
vitality -=attack;
}
void SetLockID(int lockID){m_LockedID =lockID;}
int GetLockID(){return m_LockedID;}
};
//----------------------------------------------------------------------
//CCurveMoveクラス(曲線移動をする基底クラス)
//----------------------------------------------------------------------
//曲線移動
class CCurveMove :public CEnemy
{
protected:
float X_SPEED,Y_SPEED;
float X_AXEL,Y_AXEL;
public:
// コンストラクタ、移動、描画
CCurveMove(float x, float y, float x_spd, float y_spd,
float x_axel, float y_axel,int vital)
:CEnemy(x,y,25,25,16,vital,1000),
X_SPEED(x_spd),Y_SPEED(y_spd),X_AXEL(x_axel),Y_AXEL(y_axel)
{
}
virtual void Shot() =0;
bool Move();
virtual void Draw();
};
//----------------------------------------------------------------------
//C2PointCurveMoveクラス(2点間曲線移動をする基底クラス)
//----------------------------------------------------------------------
//二点間曲線移動
class C2PointCurveMove :public CEnemy
{
protected:
int m_time1,m_time2,m_shot_time;
float X_SPEED,X_SPEED2;
float Y_AXEL,Y_AXEL2;
float m_x1,m_y1,m_x2,m_y2,m_x3,m_y3;
public:
// コンストラクタ、移動、描画
C2PointCurveMove(float x1, float y1, float x2, float y2, float x3, float y3,
int time1, int time2,int shot_time,int vital)
:CEnemy(x1,y1,25,25,16,vital,1200),
m_time1(time1),m_time2(time2),m_shot_time(shot_time),
m_x1(x1),m_y1(y1),m_x2(x2),m_y2(y2),m_x3(x3),m_y3(y3)
{
//X_SPEED =(x2-x1)/time1;
//Y_AXEL =(y2-y1)/((x2-x1)*(x2-x1));
//X_SPEED2 =(x3-x2)/time2;
//Y_AXEL2 =(y3-y2)/((x3-x2)*(x3-x2));
}
//ベジェ曲線の座標を取得する関数(始点を0、終点を1とする)
//求めたい座標の相対距離を指定
//結果を受け取る変数をポインタで指定
void BezCurve(float requere_distance,float *x,float *y);
virtual void Shot() =0;
bool Move();
virtual void Draw();
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------
//CNormalEnemy_1クラス(放射状に玉を出す敵クラス)
//----------------------------------------------------------------------
//曲線移動
class CNormalEnemy_1 :public CCurveMove
{
protected:
int shot_count,shot_count2,shotnum;
float m_shot_speed;
float m_roll,m_roll2;
public:
// コンストラクタ、移動、描画
CNormalEnemy_1(float x, float y, float x_spd, float y_spd, float x_axel, float y_axel,int vital,
float roll,float shot_speed,int shot_num,int count)
:CCurveMove(x,y,x_spd,y_spd,x_axel,y_axel,vital),
shot_count(0),shot_count2(count),m_roll(roll),m_roll2(0),
shotnum(shot_num),m_shot_speed(shot_speed)
{
}
void Shot();
};
//二点間曲線移動
class CNormalEnemy_1_2Point :public C2PointCurveMove
{
protected:
int shot_count,shot_count2,shotnum;
float m_shot_speed;
float m_roll,m_roll2;
public:
// コンストラクタ、移動、描画
CNormalEnemy_1_2Point(float x1, float y1, float x2, float y2, float x3, float y3,
int time1, int time2,int shot_time,int vital,
float roll,float shot_speed,int shot_num,int count)
:C2PointCurveMove(x1,y1,x2,y2,x3,y3,time1,time2,shot_time,vital),
shot_count(0),shot_count2(count),m_roll(roll),m_roll2(0),
shotnum(shot_num),m_shot_speed(shot_speed)
{
}
void Shot();
};
//----------------------------------------------------------------------
//CNormalEnemy_2クラス(自機狙いを出す敵クラス)
//----------------------------------------------------------------------
//曲線移動
class CNormalEnemy_2 :public CCurveMove
{
protected:
int shot_count,shot_count2;
float to_X,to_Y,m_shot_speed;
public:
// コンストラクタ、移動、描画
CNormalEnemy_2(float x, float y, float x_spd, float y_spd, float x_axel, float y_axel,int vital,
float shot_speed,int count)
:CCurveMove(x,y,x_spd,y_spd,x_axel,y_axel,vital),
shot_count(0),shot_count2(count),to_X(0),to_Y(0),m_shot_speed(shot_speed)
{
}
void Shot();
};
//二点間曲線移動
class CNormalEnemy_2_2Point :public C2PointCurveMove
{
protected:
int shot_count,shot_count2;
float to_X,to_Y,m_shot_speed;
public:
// コンストラクタ、移動、描画
CNormalEnemy_2_2Point(float x1, float y1, float x2, float y2, float x3, float y3,
int time1, int time2,int shot_time,int vital,
float shot_speed,int count)
:C2PointCurveMove(x1,y1,x2,y2,x3,y3,time1,time2,shot_time,vital),
shot_count(0),shot_count2(count),to_X(0),to_Y(0),m_shot_speed(shot_speed)
{
}
void Shot();
};
//----------------------------------------------------------------------
//CNormalEnemy_3クラス(扇形状に玉を出す敵クラス)
//----------------------------------------------------------------------
//曲線移動
class CNormalEnemy_3 :public CCurveMove
{
protected:
int m_shot_count,m_shot_count2,
m_shot_num,m_max_shot_num;
float to_X,to_Y,m_shot_speed,m_angle;
bool m_bShot;
public:
// コンストラクタ、移動、描画
CNormalEnemy_3(float x, float y, float x_spd, float y_spd, float x_axel, float y_axel,int vital,
float shot_speed,int max_shot_num,int count)
:CCurveMove(x,y,x_spd,y_spd,x_axel,y_axel,vital),
m_shot_count(0),m_shot_count2(count),m_shot_num(0),m_max_shot_num(max_shot_num),
to_X(0),to_Y(0),m_angle(0),m_shot_speed(shot_speed),m_bShot(false)
{
}
void Shot();
};
//二点間曲線移動
class CNormalEnemy_3_2Point :public C2PointCurveMove
{
protected:
int m_shot_count,m_shot_count2,
m_shot_num,m_max_shot_num;
float to_X,to_Y,m_shot_speed,m_angle;
bool m_bShot;
public:
// コンストラクタ、移動、描画
CNormalEnemy_3_2Point(float x1, float y1, float x2, float y2, float x3, float y3,
int time1, int time2,int shot_time,int vital,
float shot_speed,int max_shot_num,int count)
:C2PointCurveMove(x1,y1,x2,y2,x3,y3,time1,time2,shot_time,vital),
m_shot_count(0),m_shot_count2(count),m_shot_num(0),m_max_shot_num(max_shot_num),
to_X(0),to_Y(0),m_angle(0),m_shot_speed(shot_speed),m_bShot(false)
{
}
void Shot();
};
//----------------------------------------------------------------------
//CNormalEnemy_4クラス(自機狙いを複数出す敵クラス(奇数弾/偶数弾))
//----------------------------------------------------------------------
//曲線移動
class CNormalEnemy_4 :public CCurveMove
{
protected:
int shot_count,shot_count2;
int m_max_shot_num;
float m_delta_x;
float to_X,to_Y,m_shot_speed,m_shot_axel;
public:
// コンストラクタ、移動、描画
CNormalEnemy_4(float x, float y, float x_spd, float y_spd, float x_axel, float y_axel,int vital,
float shot_speed,float shot_axel,int count,int max_shot_num,float delta_x)
:CCurveMove(x,y,x_spd,y_spd,x_axel,y_axel,vital),
shot_count(0),shot_count2(count),to_X(0),to_Y(0),m_shot_speed(shot_speed),
m_max_shot_num(max_shot_num),m_delta_x(delta_x),m_shot_axel(shot_axel)
{
}
void Shot();
};
//二点間曲線移動
class CNormalEnemy_4_2Point :public C2PointCurveMove
{
protected:
int shot_count,shot_count2;
int m_max_shot_num;
float m_delta_x;
float to_X,to_Y,m_shot_speed,m_shot_axel;
public:
// コンストラクタ、移動、描画
CNormalEnemy_4_2Point(float x1, float y1, float x2, float y2, float x3, float y3,
int time1, int time2,int shot_time,int vital,
float shot_speed,float shot_axel,int count,int max_shot_num,float delta_x)
:C2PointCurveMove(x1,y1,x2,y2,x3,y3,time1,time2,shot_time,vital),
shot_count(0),shot_count2(count),to_X(0),to_Y(0),m_shot_speed(shot_speed),
m_max_shot_num(max_shot_num),m_delta_x(delta_x),m_shot_axel(shot_axel)
{
}
void Shot();
};
//----------------------------------------------------------------------
//CNormalEnemy_5クラス(円形に進む弾を出す敵クラス)
//----------------------------------------------------------------------
//曲線移動
class CNormalEnemy_5 :public CCurveMove
{
protected:
int m_shot_count,m_max_shot_count;
int m_shot_num;
float m_line_speed;
float m_delta_roll,m_roll;
float m_angle_spd,m_angle_axel;
float m_radius,m_rad_spd,m_rad_axel;
int m_erase_count;
public:
// コンストラクタ、移動、描画
CNormalEnemy_5(float x, float y, float x_spd, float y_spd, float x_axel, float y_axel,int vital,
float shot_speed,float roll,float delta_roll,float angle_spd,float angle_axel,
float radius,float rad_spd,float rad_axel,int shot_num,int erase_count,int shot_count)
:CCurveMove(x,y,x_spd,y_spd,x_axel,y_axel,vital),
m_shot_count(0),m_max_shot_count(shot_count),m_erase_count(erase_count),
m_shot_num(shot_num),m_line_speed(shot_speed),m_delta_roll(delta_roll),m_roll(roll),
m_angle_spd(angle_spd),m_angle_axel(angle_axel),m_radius(radius),m_rad_spd(rad_spd),m_rad_axel(rad_axel)
{
}
void Shot();
};
//二点間曲線移動
class CNormalEnemy_5_2Point :public C2PointCurveMove
{
protected:
int m_shot_count,m_max_shot_count;
int m_shot_num;
float m_line_speed;
float m_delta_roll,m_roll;
float m_angle_spd,m_angle_axel;
float m_radius,m_rad_spd,m_rad_axel;
int m_erase_count;
public:
// コンストラクタ、移動、描画
CNormalEnemy_5_2Point(float x1, float y1, float x2, float y2, float x3, float y3,
int time1, int time2,int shot_time,int vital,
float shot_speed,float roll,float delta_roll,float angle_spd,float angle_axel,
float radius,float rad_spd,float rad_axel,int shot_num,int erase_count,int shot_count)
:C2PointCurveMove(x1,y1,x2,y2,x3,y3,time1,time2,shot_time,vital),
m_shot_count(0),m_max_shot_count(shot_count),m_erase_count(erase_count),
m_shot_num(shot_num),m_line_speed(shot_speed),m_delta_roll(delta_roll),m_roll(roll),
m_angle_spd(angle_spd),m_angle_axel(angle_axel),m_radius(radius),m_rad_spd(rad_spd),m_rad_axel(rad_axel)
{
}
void Shot();
};
//----------------------------------------------------------------------
//CNormalEnemy_6クラス(小粒の弾を無造作にばら撒く敵クラス)
//----------------------------------------------------------------------
//曲線移動
class CNormalEnemy_6 :public CCurveMove
{
protected:
int m_shot_count,m_max_shot_count;
int m_shot_num;
float m_speed,m_axel;
public:
// コンストラクタ、移動、描画
CNormalEnemy_6(float x, float y, float x_spd, float y_spd, float x_axel, float y_axel,int vital,
float speed,float axel,int shot_num,int shot_count)
:CCurveMove(x,y,x_spd,y_spd,x_axel,y_axel,vital),
m_shot_count(0),m_max_shot_count(shot_count),m_shot_num(shot_num),m_speed(speed),m_axel(axel)
{
}
void Shot();
};
//二点間曲線移動
class CNormalEnemy_6_2Point :public C2PointCurveMove
{
protected:
int m_shot_count,m_max_shot_count;
int m_shot_num;
float m_speed,m_axel;
public:
// コンストラクタ、移動、描画
CNormalEnemy_6_2Point(float x1, float y1, float x2, float y2, float x3, float y3,
int time1, int time2,int shot_time,int vital,
float speed,float axel,int shot_num,int shot_count)
:C2PointCurveMove(x1,y1,x2,y2,x3,y3,time1,time2,shot_time,vital),
m_shot_count(0),m_max_shot_count(shot_count),m_shot_num(shot_num),m_speed(speed),m_axel(axel)
{
}
void Shot();
};
//----------------------------------------------------------------------
//CNormalEnemy_7クラス(特定の方向に弾を撃つ敵クラス)
//----------------------------------------------------------------------
//曲線移動
class CNormalEnemy_7 :public CCurveMove
{
protected:
int m_shot_count,m_max_shot_count;
int m_shot_num,m_max_shot_num;
float m_speed,m_max_speed,m_axel,m_angle;
public:
// コンストラクタ、移動、描画
CNormalEnemy_7(float x, float y, float x_spd, float y_spd, float x_axel, float y_axel,int vital,
float speed,float max_speed,float axel,float angle,int max_shot_num,int shot_count)
:CCurveMove(x,y,x_spd,y_spd,x_axel,y_axel,vital),
m_shot_count(0),m_max_shot_count(shot_count),m_shot_num(0),m_max_shot_num(max_shot_num),
m_speed(speed),m_max_speed(max_speed),m_axel(axel),m_angle(angle)
{
}
void Shot();
};
//二点間曲線移動
class CNormalEnemy_7_2Point :public C2PointCurveMove
{
protected:
int m_shot_count,m_max_shot_count;
int m_shot_num,m_max_shot_num;
float m_speed,m_max_speed,m_axel,m_angle;
public:
// コンストラクタ、移動、描画
CNormalEnemy_7_2Point(float x1, float y1, float x2, float y2, float x3, float y3,
int time1, int time2,int shot_time,int vital,
float speed,float max_speed,float axel,float angle,int max_shot_num,int shot_count)
:C2PointCurveMove(x1,y1,x2,y2,x3,y3,time1,time2,shot_time,vital),
m_shot_count(0),m_max_shot_count(shot_count),m_shot_num(0),m_max_shot_num(max_shot_num),
m_speed(speed),m_max_speed(max_speed),m_axel(axel),m_angle(angle)
{
}
void Shot();
};
//----------------------------------------------------------------------
//CNormalEnemy_8クラス(追尾弾敵クラス)
//----------------------------------------------------------------------
//曲線移動
class CNormalEnemy_8 :public CCurveMove
{
protected:
int m_shot_count,m_max_shot_count;
float m_speed,m_axel,m_angle,m_max_angle;
public:
// コンストラクタ、移動、描画
CNormalEnemy_8(float x, float y, float x_spd, float y_spd, float x_axel, float y_axel,int vital,
float speed,float axel,float angle,float max_angle,int shot_count)
:CCurveMove(x,y,x_spd,y_spd,x_axel,y_axel,vital),
m_shot_count(0),m_max_shot_count(shot_count),
m_speed(speed),m_axel(axel),m_angle(angle),m_max_angle(D3DXToRadian(max_angle))
{
}
void Shot();
};
//二点間曲線移動
class CNormalEnemy_8_2Point :public C2PointCurveMove
{
protected:
int m_shot_count,m_max_shot_count;
float m_speed,m_axel,m_angle,m_max_angle;
public:
// コンストラクタ、移動、描画
CNormalEnemy_8_2Point(float x1, float y1, float x2, float y2, float x3, float y3,
int time1, int time2,int shot_time,int vital,
float speed,float axel,float angle,float max_angle,int shot_count)
:C2PointCurveMove(x1,y1,x2,y2,x3,y3,time1,time2,shot_time,vital),
m_shot_count(0),m_max_shot_count(shot_count),
m_speed(speed),m_axel(axel),m_angle(angle),m_max_angle(D3DXToRadian(max_angle))
{
}
void Shot();
};