/*L*/

/*‚r‚s‚f‚̍ì‚è•û@Š®¬ƒ\[ƒX*/

/*–ÚŽŸ‚Ö–ß‚é*/

#include "DxLib.h" #include <time.h> #include <math.h> #define LEFT_LIMIT -220 #define RIGHT_LIMIT 220 #define TOP_LIMIT 240 #define BOTTOM_LIMIT -240 #define PLAYER_SHOT_MAX 30 #define DISP_ENEMY_MAX 30 #define STAGE_ENEMY_MAX 85 #define ENEMY_DATA_MAX 9 #define ENEMY_SHOT_MAX 30 #define DISP_BOSS_MAX 6 #define STAGE_BOSS_MAX 6 #define BOSS_DATA_MAX 10 #define BOSS_SHOT_MAX 20 #define EXP_EFFECT_MAX 20 #define ITEM_MAX 10 #define STAGE_MAX 3 void my_init_back_img(void); void my_init_img(void); void my_init_sound(void); void my_init_variable(void); void my_init_variable2(void); void my_init_player(void); void my_init_player2(void); void my_init_player_shot(void); void my_init_player_shot2(void); void my_init_enemy(void); void my_init_enemy2(void); void my_init_enemy_shot(void); void my_init_enemy_shot2(void); void my_init_boss(void); void my_init_boss2(void); void my_init_boss_shot(void); void my_init_boss_shot2(void); void my_init_exp_effect(void); void my_init_exp_effect2(void); void my_init_item(void); void my_init_item2(void); void my_init_barrier(void); void my_init_barrier2(void); void my_init_bomb(void); void my_init_bomb2(void); void my_set_player_shot(int ); void my_set_enemy(void); void my_set_enemy_shot(double,double,int,int); void my_set_boss(void); void my_set_boss_shot(double,double,int,int); void my_set_exp_effect(double,double,int); void my_set_item(double,double,int); void my_set_barrier(void); void my_set_bomb(void); void my_move_back(void); void my_move_player(void); void my_move_player_shot(void); void my_move_enemy(void); void my_move_enemy_shot(void); void my_move_boss(void); void my_move_boss_shot(void); void my_move_exp_effect(void); void my_move_item(void); void my_move_barrier(void); void my_move_bomb(void); int my_pythago_theorem(double,double,double,double,double,double); void my_collision_detection(void); void my_collision_player_enemy(void); void my_collision_player_shot_enemy(void); void my_collision_player_enemy_shot(void); void my_collision_player_boss(void); void my_collision_player_shot_boss(void); void my_collision_player_boss_shot(void); void my_collision_player_item(void); void my_collision_barrier_enemy(void); void my_collision_barrier_enemy_shot(void); void my_collision_barrier_boss(void); void my_collision_barrier_boss_shot(void); void my_collision_bomb_enemy(void); void my_collision_bomb_enemy_shot(void); void my_check_player_power(void); void my_check_enemy_power(void); void my_check_boss_power(void); void my_check_barrier_power(void); void my_change_state(void); void my_to_center(void); void my_calc_img(void); void my_draw_op(void); void my_draw_ed(void); void my_draw_stage_num(void); void my_draw_start(void); void my_draw_clear(void); void my_draw_back(void); void my_draw_player(void); void my_draw_player_shot(void); void my_draw_enemy(void); void my_draw_enemy_shot(void); void my_draw_enemy_power(void); void my_draw_boss(void); void my_draw_boss_shot(void); void my_draw_boss_power(void); void my_draw_exp_effect(void); void my_draw_item(void); void my_draw_barrier(void); void my_draw_bomb(void); void my_draw_score_board(void); void my_draw_gameover(void); void my_play_se_sound(int); void my_search_bgm_sound(void); void my_play_bgm_sound(int); void my_stop_bgm_sound(void); void my_timer(void); int my_get_key(void); struct PLAYER{ double x, y; double draw_x, draw_y; int speed; int shot_type; int bomb; int power; int life; double range; }; struct PLAYER p1; struct PLAYER_SHOT{ double x[5]; double y[5]; double draw_x[5]; double draw_y[5]; int init_flag; int move_flag; int move_type; int flag[5]; double angle[5]; int max_bullet; int gamecount_point; double range; }; struct PLAYER_SHOT ps1[PLAYER_SHOT_MAX]; struct ENEMY{ int serial_num; int appear_point; double first_x, first_y; double x, y; double draw_x, draw_y; double m_x,m_y; double a_x,a_y; double f_x,f_y; int init_flag; int move_flag; double angle; int move_type; int shot_type; int pattern; double var[5]; int gamecount_point; int power; double range; int item_flag; }; struct ENEMY enemy[DISP_ENEMY_MAX]; struct ENEMY_SHOT{ double first_x; double first_y; double x[10]; double y[10]; double draw_x[10]; double draw_y[10]; double angle[10]; int init_flag; int move_flag; int move_type; int max_bullet; int gamecount_point[5]; double range; int enemy_num; }; struct ENEMY_SHOT enemy_shot[ENEMY_SHOT_MAX]; struct BOSS{ int serial_num; int appear_point; double first_x, first_y; double x, y; double draw_x, draw_y; double angle; int init_flag; int move_flag; int damage_flag; int move_type; int shot_type; double var[5]; int gamecount_point[5]; int power; double range; int item_flag; int end_flag; }; struct BOSS boss[DISP_BOSS_MAX]; struct BOSS_SHOT{ double first_x; double first_y; double x[300]; double y[300]; double draw_x[300]; double draw_y[300]; double angle[300]; double angle2[300]; double var[300]; int init_flag; int move_flag; int move_type; int max_bullet; int gamecount_point[5]; double range; int boss_num; }; struct BOSS_SHOT boss_shot[BOSS_SHOT_MAX]; struct EXP_EFFECT{ double first_x; double first_y; double x; double y; double draw_x; double draw_y; int init_flag; int move_flag; int move_type; int gamecount_point; }; struct EXP_EFFECT exp_effect[EXP_EFFECT_MAX]; struct ITEM{ double first_x; double first_y; double x; double y; double draw_x; double draw_y; double m_x,m_y; double a_x,a_y; double f_x,f_y; int init_flag; int move_flag; int move_type; int gamecount_point; double range; }; struct ITEM item[ITEM_MAX]; struct BARRIER{ double x, y; double draw_x, draw_y; int init_flag; int move_flag; double angle; int power; double range; }; struct BARRIER barrier1; struct BOMB{ int init_flag; int move_flag; int count; int flag; }; struct BOMB bomb1; int ary_enemy_data[STAGE_MAX][STAGE_ENEMY_MAX * ENEMY_DATA_MAX] = { { 6,100,100,260,10,0,1,10,0, 6,120,100,260,10,0,1,10,0, 6,140,100,260,10,0,1,10,0, 6,160,100,260,10,0,1,10,0, 6,180,100,260,10,0,1,10,0, 6,200,100,260,10,0,1,10,0, 6,220,100,260,10,0,1,10,0, 6,240,100,260,10,0,1,10,0, 6,600,-100,260,10,0,1,10,0, 6,620,-100,260,10,0,1,10,0, 6,640,-100,260,10,0,1,10,0, 6,660,-100,260,10,0,1,10,0, 6,680,-100,260,10,0,1,10,0, 6,700,-100,260,10,0,1,10,0, 6,720,-100,260,10,0,1,10,0, 6,740,-100,260,10,0,1,10,0, 6,1100,100,260,10,0,1,10,0, 6,1120,100,260,10,0,1,10,0, 6,1140,100,260,10,0,1,10,0, 6,1160,100,260,10,0,1,10,0, 6,1180,100,260,10,0,1,10,0, 6,1200,100,260,10,0,1,10,0, 6,1220,100,260,10,0,1,10,0, 6,1240,100,260,10,0,1,10,1, 7,1600,0,260,11,2,1,10,0, 7,1700,0,260,11,2,1,10,0, 7,1800,0,260,11,2,1,10,0, 7,1900,0,260,11,2,1,10,0, 7,2000,0,260,11,2,1,10,0, 7,2100,0,260,11,2,1,10,0, 7,2200,0,260,11,2,1,10,0, 7,2300,0,260,11,2,1,10,0, 8,2400,-300,260,13,2,10,10,0, 8,2450,250,260,13,2,10,10,0, 8,2500,-200,260,13,2,10,10,0, 8,2550,-100,260,13,2,10,10,0, 8,2600,100,260,13,2,10,10,0, 8,2650,300,260,13,2,10,10,0, 8,2700,-150,260,13,2,10,10,0, 8,2750,100,260,13,2,10,10,0, 6,3300,100,260,10,0,1,10,0, 6,3320,100,260,10,0,1,10,0, 6,3340,100,260,10,0,1,10,0, 6,3360,100,260,10,0,1,10,0, 6,3380,100,260,10,0,1,10,0, 6,3400,100,260,10,0,1,10,0, 6,3420,100,260,10,0,1,10,0, 6,3440,100,260,10,0,1,10,0, 6,3800,-100,260,10,0,1,10,0, 6,3820,-100,260,10,0,1,10,0, 6,3840,-100,260,10,0,1,10,0, 6,3860,-100,260,10,0,1,10,0, 6,3880,-100,260,10,0,1,10,0, 6,3900,-100,260,10,0,1,10,0, 6,3920,-100,260,10,0,1,10,0, 6,3940,-100,260,10,0,1,10,1, 9,6000,-320,-260,14,2,1,10,0, 9,6050,320,-260,15,2,1,10,0, 9,6100,-320,-260,14,2,1,10,0, 9,6150,320,-260,15,2,1,10,0, 9,6200,-320,-260,14,2,1,10,0, 9,6250,320,-260,15,2,1,10,0, 9,6300,-320,-260,14,2,1,10,0, 9,6350,320,-260,15,2,1,10,0, 10,6500,-340,200,16,0,20,10,0, 10,6550,-150,260,16,0,20,10,0, 10,6600,0,260,16,0,20,10,0, 10,6650,100,260,16,0,20,10,0, 10,6700,340,200,16,0,20,10,0, 10,6750,150,260,16,0,20,10,0, 10,6800,0,260,16,0,20,10,0, 10,6850,-100,260,16,0,20,10,0, 7,7000,-300,260,11,2,1,10,0, 7,7050,300,260,11,2,1,10,0, 7,7100,-100,260,11,2,1,10,0, 7,7150,200,260,11,2,1,10,0, 7,7200,150,260,11,2,1,10,0, 7,7250,-150,260,11,2,1,10,0, 7,7300,0,260,11,2,1,10,0, 7,7350,100,260,11,2,1,10,0, 13,7700,0,260,19,3,1,10,1, 13,7750,0,260,20,3,1,10,0, 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0 }, { 11,100,-100,260,17,2,20,10,0, 11,100,100,260,17,2,20,10,0, 6,500,100,260,10,0,1,10,0, 6,520,100,260,10,0,1,10,0, 6,540,100,260,10,0,1,10,0, 6,560,100,260,10,0,1,10,0, 6,580,100,260,10,0,1,10,0, 6,600,100,260,10,0,1,10,0, 6,620,100,260,10,0,1,10,0, 6,640,100,260,10,0,1,10,0, 6,1000,-100,260,10,0,1,10,0, 6,1020,-100,260,10,0,1,10,0, 6,1040,-100,260,10,0,1,10,0, 6,1060,-100,260,10,0,1,10,0, 6,1080,-100,260,10,0,1,10,0, 6,1100,-100,260,10,0,1,10,0, 6,1120,-100,260,10,0,1,10,0, 6,1140,-100,260,10,0,1,10,0, 6,1500,100,260,10,0,1,10,0, 6,1520,100,260,10,0,1,10,0, 6,1540,100,260,10,0,1,10,0, 6,1560,100,260,10,0,1,10,0, 6,1580,100,260,10,0,1,10,0, 6,1600,100,260,10,0,1,10,0, 6,1620,100,260,10,0,1,10,0, 6,1640,100,260,10,0,1,10,1, 12,2000,0,260,18,2,1,10,0, 12,2050,100,300,18,2,1,10,0, 12,2100,-130,280,18,2,1,10,0, 12,2150,160,260,18,2,1,10,0, 12,2200,10,260,18,2,1,10,0, 12,2250,0,300,18,2,1,10,0, 12,2300,-200,260,18,2,1,10,0, 12,2350,100,260,18,2,1,10,0, 12,2400,-180,300,18,2,1,10,0, 12,2450,50,260,18,2,1,10,0, 5,2500,0,340,9,2,1,10,0, 5,2500,40,340,9,2,1,10,0, 5,2500,-40,340,9,2,1,10,0, 5,2500,80,340,9,2,1,10,0, 5,2500,-80,340,9,2,1,10,0, 5,2500,120,340,9,2,1,10,0, 5,2500,-120,340,9,2,1,10,0, 5,2500,160,340,9,2,1,10,0, 5,2500,-160,340,9,2,1,10,1, 5,2500,200,340,9,2,1,10,0, 5,2500,-200,340,9,2,1,10,0, 5,2500,0,320,9,2,1,10,0, 5,2500,0,360,9,2,1,10,0, 11,3200,-100,260,17,2,20,10,0, 11,3200,100,260,17,2,20,10,0, 12,5500,-200,260,18,5,1,10,0, 12,5550,200,260,18,5,1,10,0, 12,5600,-100,260,18,5,1,10,0, 12,5650,100,260,18,5,1,10,0, 12,5700,0,260,18,5,1,10,1, 9,6000,-320,-260,14,2,1,10,0, 9,6050,320,-260,15,2,1,10,0, 9,6100,-320,-260,14,2,1,10,0, 9,6150,320,-260,15,2,1,10,0, 9,6200,-320,-260,14,2,1,10,0, 9,6250,320,-260,15,2,1,10,0, 9,6300,-320,-260,14,2,1,10,0, 9,6350,320,-260,15,2,1,10,0, 10,6500,-340,200,16,0,20,10,0, 10,6550,-150,260,16,0,20,10,0, 10,6600,0,260,16,0,20,10,0, 10,6650,100,260,16,0,20,10,0, 10,6700,340,200,16,0,20,10,0, 10,6750,150,260,16,0,20,10,0, 10,6800,0,260,16,0,20,10,0, 10,6850,-100,260,16,0,20,10,0, 7,7000,-300,260,11,2,1,10,0, 7,7050,300,260,11,2,1,10,0, 7,7100,-100,260,11,2,1,10,0, 7,7150,200,260,11,2,1,10,0, 7,7200,150,260,11,2,1,10,0, 7,7250,-150,260,11,2,1,10,0, 7,7300,0,260,11,2,1,10,0, 7,7350,100,260,11,2,1,10,0, 13,7700,0,260,19,3,1,10,0, 13,7750,0,260,20,3,1,10,1, 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0 }, { 6,100,100,260,10,0,1,10,0, 6,120,100,260,10,0,1,10,0, 6,140,100,260,10,0,1,10,0, 6,160,100,260,10,0,1,10,0, 6,180,100,260,10,0,1,10,0, 6,200,100,260,10,0,1,10,0, 6,220,100,260,10,0,1,10,0, 6,240,100,260,10,0,1,10,0, 6,600,-100,260,10,0,1,10,0, 6,620,-100,260,10,0,1,10,0, 6,640,-100,260,10,0,1,10,0, 6,660,-100,260,10,0,1,10,0, 6,680,-100,260,10,0,1,10,0, 6,700,-100,260,10,0,1,10,0, 6,720,-100,260,10,0,1,10,0, 6,740,-100,260,10,0,1,10,0, 6,1100,100,260,10,0,1,10,0, 6,1120,100,260,10,0,1,10,0, 6,1140,100,260,10,0,1,10,0, 6,1160,100,260,10,0,1,10,0, 6,1180,100,260,10,0,1,10,0, 6,1200,100,260,10,0,1,10,0, 6,1220,100,260,10,0,1,10,0, 6,1240,100,260,10,0,1,10,1, 11,1700,-100,260,17,2,20,10,0, 11,1700,100,260,17,2,20,10,0, 4,1900,0,260,7,4,1,10,0, 11,2400,-100,260,17,2,20,10,0, 11,2400,100,260,17,2,20,10,0, 4,2600,0,260,8,4,1,10,0, 11,3100,-100,260,17,2,20,10,0, 11,3100,100,260,17,2,20,10,0, 3,3300,0,260,5,3,1,10,0, 3,3300,0,260,6,3,1,10,0, 11,3800,-100,260,17,2,20,10,0, 11,3800,100,260,17,2,20,10,0, 6,4500,100,260,10,0,1,10,0, 6,4520,100,260,10,0,1,10,0, 6,4540,100,260,10,0,1,10,0, 6,4560,100,260,10,0,1,10,0, 6,4580,100,260,10,0,1,10,0, 6,4600,100,260,10,0,1,10,0, 6,4620,100,260,10,0,1,10,0, 6,4640,100,260,10,0,1,10,0, 6,5000,-100,260,10,0,1,10,0, 6,5020,-100,260,10,0,1,10,0, 6,5040,-100,260,10,0,1,10,0, 6,5060,-100,260,10,0,1,10,0, 6,5080,-100,260,10,0,1,10,0, 6,5100,-100,260,10,0,1,10,0, 6,5120,-100,260,10,0,1,10,0, 6,5140,-100,260,10,0,1,10,1, 5,7800,-200,280,9,2,1,10,0, 5,7800,-160,280,9,2,1,10,0, 5,7800,-120,280,9,2,1,10,0, 5,7800,-160,300,9,2,1,10,0, 5,7800,-160,260,9,2,1,10,0, 5,8000,200,280,9,2,1,10,0, 5,8000,160,280,9,2,1,10,0, 5,8000,120,280,9,2,1,10,0, 5,8000,160,300,9,2,1,10,0, 5,8000,160,260,9,2,1,10,0, 5,8200,-200,280,9,2,1,10,0, 5,8200,-160,280,9,2,1,10,0, 5,8200,-120,280,9,2,1,10,0, 5,8200,-160,300,9,2,1,10,0, 5,8200,-160,260,9,2,1,10,0, 5,8400,200,280,9,2,1,10,0, 5,8400,160,280,9,2,1,10,0, 5,8400,120,280,9,2,1,10,0, 5,8400,160,300,9,2,1,10,0, 5,8400,160,260,9,2,1,10,0, 12,8000,-200,260,18,2,1,10,0, 12,8050,200,260,18,2,1,10,0, 12,8100,-100,260,18,2,1,10,0, 12,8150,100,260,18,2,1,10,0, 12,8200,-100,260,18,2,20,10,0, 12,8300,100,260,18,2,20,10,0, 12,8400,200,260,18,2,1,10,0, 12,8450,-100,260,18,2,1,10,0, 12,8500,0,260,18,2,1,10,0, 12,8550,-150,260,18,2,1,10,0, 12,8600,-200,260,18,2,1,10,0, 12,8650,200,260,18,2,1,10,0, 12,8700,0,260,18,2,1,10,1 } }; int ary_boss_data[STAGE_MAX][STAGE_BOSS_MAX * BOSS_DATA_MAX] = { { 0,4100,0,260,2,0,100,10,0,0, 2,7900,0,260,2,1,120,10,0,1, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0 }, { 0,3000,0,260,2,0,100,10,0,0, 6,7900,0,260,2,2,120,10,0,1, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0 }, { 2,5300,0,260,2,1,120,10,0,0, 4,5300,0,260,3,3,30,10,0,0, 6,9000,0,260,4,2,120,10,0,1, 4,9000,-20,280,4,3,30,10,0,0, 4,9000,20,280,4,3,30,10,0,0, 0,0,0,0,0,0,0,0,0,0 } }; int key[256]; double back_img_x; double back_img_y; double back_img_speed; int back_img; int back_img2; int back_img3; int gamecount; int gamecount2; int gamecount3; int game_state; int stage_num; int gameover_flag; int gameclear_flag; int score; int Color_White; int Color_Gray; int Color_Red; int Color_Green; int op_img; int ed_img; int player_img_count; int player_chip[4]; int player_shot_img; int enemy_chip[14]; int enemy_shot_img; int boss_img_count; int boss_chip[8]; int boss_shot_img; int exp_effect_chip[2]; int item_img; int barrier_img; int se1; int se2; int se3; int se4; int se5; int se6; int bgm1; int bgm2; int bgm3; int bgm4; int bgm5; int bgm6; int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int){ ChangeWindowMode(TRUE); DxLib_Init(); SetDrawScreen(DX_SCREEN_BACK); while (ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && my_get_key()==0){ switch(game_state){ case 0: my_init_back_img(); my_init_img(); my_init_sound(); game_state = 2; break; case 2: my_search_bgm_sound(); my_init_variable(); my_init_player(); my_init_player_shot(); my_init_enemy(); my_init_enemy_shot(); my_init_boss(); my_init_boss_shot(); my_init_exp_effect(); my_init_item(); my_init_barrier(); my_init_bomb(); game_state = 4; break; case 4: my_search_bgm_sound(); my_draw_op(); if (key[KEY_INPUT_RETURN] == 1){ gamecount = 0; game_state = 5; my_play_se_sound(0); } else{ my_timer(); } break; case 5: my_search_bgm_sound(); my_init_variable2(); my_init_player2(); my_init_player_shot2(); my_init_enemy2(); my_init_enemy_shot2(); my_init_boss2(); my_init_boss_shot2(); my_init_exp_effect2(); my_init_item2(); my_init_barrier2(); my_init_bomb2(); game_state = 10; break; case 10: my_search_bgm_sound(); my_draw_stage_num(); if(gamecount == 300){ gamecount = 0; game_state = 15; } else{ my_timer(); } break; case 15: my_search_bgm_sound(); my_move_back(); my_move_barrier(); my_to_center(); my_calc_img(); my_draw_back(); my_draw_player(); my_draw_barrier(); my_draw_score_board(); if(gamecount2 % 2 == 1){ my_draw_start(); } if(gamecount == 200){ gamecount = 0; gamecount2 = 0; game_state = 20; } else{ if (gamecount % 10 == 1){ back_img_speed *= 0.9f; gamecount2++; } p1.y++; my_timer(); } break; case 20: my_search_bgm_sound(); my_set_enemy(); my_set_boss(); my_move_back(); my_move_player(); my_move_player_shot(); my_move_enemy(); my_move_enemy_shot(); my_move_boss(); my_move_boss_shot(); my_move_exp_effect(); my_move_item(); my_move_barrier(); my_move_bomb(); my_collision_detection(); my_to_center(); my_calc_img(); my_draw_back(); my_draw_player(); my_draw_player_shot(); my_draw_enemy(); my_draw_enemy_shot(); //my_draw_enemy_power(); my_draw_boss(); my_draw_boss_shot(); //my_draw_boss_power(); my_draw_exp_effect(); my_draw_item(); my_draw_barrier(); my_draw_bomb(); my_draw_score_board(); my_draw_gameover(); my_change_state(); my_timer(); break; case 25: my_search_bgm_sound(); my_move_back(); my_move_barrier(); my_to_center(); my_calc_img(); my_draw_back(); my_draw_player(); my_draw_barrier(); my_draw_score_board(); if(gamecount2 % 2 == 1){ my_draw_clear(); } if(gamecount == 500){ if(stage_num == STAGE_MAX){ gamecount = 0; game_state = 30; } else{ gamecount = 0; game_state = 5; } } else{ if (gamecount % 10 == 1){ back_img_speed *= 1.1f; gamecount2++; } p1.y++; my_timer(); } break; case 30: my_search_bgm_sound(); my_draw_ed(); my_timer(); break; default: break; } } DxLib_End(); return 0; } void my_init_back_img(){ back_img = LoadGraph("../back_img.png"); back_img2 = LoadGraph("../back_img2.jpg"); back_img3 = LoadGraph("../back_img3.jpg"); } void my_init_img(){ op_img = LoadGraph("../op_img.jpg"); ed_img = LoadGraph("../ed_img.jpg"); LoadDivGraph("../player_chip.png",4,4,1,70,70,player_chip); player_shot_img = LoadGraph("../player_shot_img.png"); LoadDivGraph("../enemy_chip.png",14,1,14,70,70,enemy_chip); enemy_shot_img = LoadGraph("../enemy_shot_img.png"); LoadDivGraph("../boss_chip.png",8,2,4,300,300,boss_chip); boss_shot_img = LoadGraph("../boss_shot_img.png"); LoadDivGraph("../exp_effect_chip.png",2,2,1,70,70,exp_effect_chip); item_img = LoadGraph("../item_img.png"); barrier_img = LoadGraph("../barrier_img.png"); } void my_init_sound(){ se1 = LoadSoundMem("../se1.ogg"); se2 = LoadSoundMem("../se2.ogg"); se3 = LoadSoundMem("../se3.ogg"); se4 = LoadSoundMem("../se4.ogg"); se5 = LoadSoundMem("../se5.ogg"); se6 = LoadSoundMem("../se6.ogg"); bgm1 = LoadSoundMem("../bgm1.ogg"); bgm2 = LoadSoundMem("../bgm2.ogg"); bgm3 = LoadSoundMem("../bgm3.ogg"); bgm4 = LoadSoundMem("../bgm4.ogg"); bgm5 = LoadSoundMem("../bgm5.ogg"); bgm6 = LoadSoundMem("../bgm6.ogg"); } void my_init_variable(){ gamecount = 0; gamecount2 = 0; gamecount3 = 0; game_state = 0; stage_num = 0; gameover_flag = 0; gameclear_flag = 0; score = 0; Color_White = GetColor(255, 255, 255); Color_Gray = GetColor(100, 100, 100); Color_Red = GetColor(255, 0, 0); Color_Green = GetColor(0, 255, 0); back_img_x = -220; back_img_y = 0; back_img_speed = 8; player_img_count = 0; boss_img_count = 0; SetFontSize(16); } void my_init_variable2(){ gamecount = 0; gamecount2 = 0; gamecount3 = 0; gameover_flag = 0; gameclear_flag = 0; back_img_x = -220; back_img_y = 0; back_img_speed = 8; srand((unsigned)time(NULL)); } void my_init_player(){ p1.x = 0; p1.y = -300; p1.draw_x = 0; p1.draw_y = 0; p1.speed = 4; p1.shot_type = 0; p1.bomb = 1; p1.power = 1; p1.life = 3; p1.range = 10; } void my_init_player2(){ p1.x = 0; p1.y = -300; p1.bomb = 1; p1.power = 1; } void my_init_player_shot(){ for(int i = 0;i < PLAYER_SHOT_MAX;i++){ ps1[i].init_flag = 0; ps1[i].move_flag = 0; ps1[i].move_type = 0; ps1[i].max_bullet = 0; ps1[i].gamecount_point = 0; ps1[i].range = 10; for(int j = 0;j < 5;j++){ ps1[i].x[j] = 0; ps1[i].y[j] = 0; ps1[i].draw_x[j] = 0; ps1[i].draw_y[j] = 0; ps1[i].flag[j] = 0; ps1[i].angle[j] = 0; } } } void my_init_player_shot2(){ for(int i = 0;i < PLAYER_SHOT_MAX;i++){ ps1[i].init_flag = 0; ps1[i].move_flag = 0; } } void my_init_enemy(){ for (int i = 0; i < DISP_ENEMY_MAX; i++){ enemy[i].serial_num = 0; enemy[i].appear_point = 0; enemy[i].first_x = 0; enemy[i].first_y = 0; enemy[i].x = 0; enemy[i].y = 0; enemy[i].draw_x = 0; enemy[i].draw_y = 0; enemy[i].m_x = 0; enemy[i].m_y = 0; enemy[i].a_x = 0; enemy[i].a_y = 0; enemy[i].f_x = 0; enemy[i].f_y = 0; enemy[i].init_flag = 0; enemy[i].move_flag = 0; enemy[i].angle = 0; enemy[i].move_type = 0; enemy[i].shot_type = 0; enemy[i].pattern = 0; enemy[i].gamecount_point = 0; enemy[i].power = 0; enemy[i].range = 0; enemy[i].item_flag = 0; for(int j = 0;j < 5;j++){ enemy[i].var[j] = 0; } } } void my_init_enemy2(){ for (int i = 0; i < DISP_ENEMY_MAX; i++){ enemy[i].init_flag = 0; enemy[i].move_flag = 0; } } void my_init_enemy_shot(){ for (int i = 0; i < ENEMY_SHOT_MAX; i++){ enemy_shot[i].first_x = 0; enemy_shot[i].first_y = 0; enemy_shot[i].init_flag = 0; enemy_shot[i].move_flag = 0; enemy_shot[i].move_type = 0; enemy_shot[i].max_bullet = 0; enemy_shot[i].range = 10; enemy_shot[i].enemy_num = 0; for(int j = 0;j < 10;j++){ enemy_shot[i].x[j] = 0; enemy_shot[i].y[j] = 0; enemy_shot[i].draw_x[j] = 0; enemy_shot[i].draw_y[j] = 0; enemy_shot[i].angle[j] = 0; } for(int j = 0;j < 5;j++){ enemy_shot[i].gamecount_point[j] = 0; } } } void my_init_enemy_shot2(){ for (int i = 0; i < ENEMY_SHOT_MAX; i++){ enemy_shot[i].init_flag = 0; enemy_shot[i].move_flag = 0; } } void my_init_boss(){ for (int i = 0; i < DISP_BOSS_MAX; i++){ boss[i].serial_num = 0; boss[i].appear_point = 0; boss[i].first_x = 0; boss[i].first_y = 0; boss[i].x = 0; boss[i].y = 0; boss[i].draw_x = 0; boss[i].draw_y = 0; boss[i].angle = 0; boss[i].init_flag = 0; boss[i].move_flag = 0; boss[i].damage_flag = 0; boss[i].move_type = 0; boss[i].shot_type = 0; boss[i].power = 0; boss[i].range = 0; boss[i].item_flag = 0; boss[i].end_flag = 0; for(int j = 0;j < 5;j++){ boss[i].var[j] = 0; boss[i].gamecount_point[j] = 0; } } } void my_init_boss2(){ for (int i = 0; i < DISP_BOSS_MAX; i++){ boss[i].init_flag = 0; boss[i].move_flag = 0; } } void my_init_boss_shot(){ for (int i = 0; i < BOSS_SHOT_MAX; i++){ boss_shot[i].first_x = 0; boss_shot[i].first_y = 0; boss_shot[i].init_flag = 0; boss_shot[i].move_flag = 0; boss_shot[i].move_type = 0; boss_shot[i].max_bullet = 0; boss_shot[i].range = 10; boss_shot[i].boss_num = 0; for(int j = 0;j < 300;j++){ boss_shot[i].x[j] = 0; boss_shot[i].y[j] = 0; boss_shot[i].draw_x[j] = 0; boss_shot[i].draw_y[j] = 0; boss_shot[i].angle[j] = 0; boss_shot[i].angle2[j] = 0; boss_shot[i].var[j] = 0; } for(int j = 0;j < 5;j++){ boss_shot[i].gamecount_point[j] = 0; } } } void my_init_boss_shot2(){ for (int i = 0; i < BOSS_SHOT_MAX; i++){ boss_shot[i].init_flag = 0; boss_shot[i].move_flag = 0; } } void my_init_exp_effect(){ for (int i = 0; i < EXP_EFFECT_MAX; i++){ exp_effect[i].first_x = 0; exp_effect[i].first_y = 0; exp_effect[i].x = 0; exp_effect[i].y = 0; exp_effect[i].draw_x = 0; exp_effect[i].draw_y = 0; exp_effect[i].init_flag = 0; exp_effect[i].move_flag = 0; exp_effect[i].move_type = 0; exp_effect[i].gamecount_point = 0; } } void my_init_exp_effect2(){ for (int i = 0; i < EXP_EFFECT_MAX; i++){ exp_effect[i].init_flag = 0; exp_effect[i].move_flag = 0; } } void my_init_item(){ for (int i = 0; i < ITEM_MAX; i++){ item[i].first_x = 0; item[i].first_y = 0; item[i].x = 0; item[i].y = 0; item[i].draw_x = 0; item[i].draw_y = 0; item[i].m_x = 0; item[i].m_y = 0; item[i].a_x = 0; item[i].a_y = 0; item[i].f_x = 0; item[i].f_y = 0; item[i].init_flag = 0; item[i].move_flag = 0; item[i].move_type = 0; item[i].range = 10; item[i].gamecount_point = 0; } } void my_init_item2(){ for (int i = 0; i < ITEM_MAX; i++){ item[i].init_flag = 0; item[i].move_flag = 0; } } void my_init_barrier(){ barrier1.x = 0; barrier1.y = 0; barrier1.draw_x = 0; barrier1.draw_y = 0; barrier1.init_flag = 0; barrier1.move_flag = 0; barrier1.angle = 0; barrier1.power = 30; barrier1.range = 5; } void my_init_barrier2(){ barrier1.power = 30; } void my_init_bomb(){ bomb1.init_flag = 0; bomb1.move_flag = 0; bomb1.count = 0; bomb1.flag = 0; } void my_init_bomb2(){ bomb1.init_flag = 0; bomb1.move_flag = 0; } void my_move_back(){ if (key[KEY_INPUT_RIGHT] >= 1 && p1.x < RIGHT_LIMIT && game_state == 20){ back_img_x -= 0.5f; } if (key[KEY_INPUT_LEFT] >= 1 && p1.x > LEFT_LIMIT && game_state == 20){ back_img_x += 0.5f; } back_img_y += back_img_speed; if (back_img_y > 480){ back_img_y = 0; } } void my_move_player(){ if(p1.power > 0){ if (key[KEY_INPUT_RIGHT] >= 1 && p1.x < RIGHT_LIMIT){ p1.x += p1.speed; } if (key[KEY_INPUT_DOWN] >= 1 && p1.y > BOTTOM_LIMIT){ p1.y -= p1.speed; } if (key[KEY_INPUT_LEFT] >= 1 && p1.x > LEFT_LIMIT){ p1.x -= p1.speed; } if (key[KEY_INPUT_UP] >= 1 && p1.y < TOP_LIMIT){ p1.y += p1.speed; } if (key[KEY_INPUT_Z] % 5 == 1){ my_set_player_shot(p1.shot_type); my_play_se_sound(1); } if (key[KEY_INPUT_X] == 1 && p1.bomb > 0){ my_set_bomb(); my_play_se_sound(5); } } } void my_set_player_shot(int shot_type){ for(int i = 0;i < PLAYER_SHOT_MAX;i++){ if(ps1[i].move_flag == 0){ ps1[i].move_type = shot_type; ps1[i].move_flag = 1; break; } } } void my_move_player_shot(){ for(int i = 0;i < PLAYER_SHOT_MAX;i++){ if(ps1[i].move_flag == 1){ switch(ps1[i].move_type){ case 0: if(ps1[i].init_flag == 0){ ps1[i].max_bullet = 1; for(int j = 0;j < ps1[i].max_bullet;j++){ ps1[i].x[j] = p1.x; ps1[i].y[j] = p1.y; ps1[i].flag[j] = 1; } ps1[i].gamecount_point = gamecount; ps1[i].init_flag = 1; } else{ if(gamecount < ps1[i].gamecount_point + 100){ for(int j = 0;j < ps1[i].max_bullet;j++){ ps1[i].y[j] += 8; } } else{ ps1[i].move_flag = 0; ps1[i].init_flag = 0; } } break; case 1: if(ps1[i].init_flag == 0){ ps1[i].max_bullet = 2; for(int j = 0;j < ps1[i].max_bullet;j++){ ps1[i].x[j] = p1.x; ps1[i].y[j] = p1.y; ps1[i].flag[j] = 1; } ps1[i].x[0] += 10; ps1[i].x[1] -= 10; ps1[i].gamecount_point = gamecount; ps1[i].init_flag = 1; } else{ if(gamecount < ps1[i].gamecount_point + 100){ for(int j = 0;j < ps1[i].max_bullet;j++){ ps1[i].y[j] += 8; } } else{ ps1[i].move_flag = 0; ps1[i].init_flag = 0; } } break; case 2: if(ps1[i].init_flag == 0){ ps1[i].max_bullet = 5; for(int j = 0;j < ps1[i].max_bullet;j++){ ps1[i].x[j] = p1.x; ps1[i].y[j] = p1.y; ps1[i].flag[j] = 1; } ps1[i].angle[0] = 90 * (DX_PI / 180); ps1[i].angle[1] = 135 * (DX_PI / 180); ps1[i].angle[2] = 225 * (DX_PI / 180); ps1[i].angle[3] = 315 * (DX_PI / 180); ps1[i].angle[4] = 45 * (DX_PI / 180); ps1[i].gamecount_point = gamecount; ps1[i].init_flag = 1; } else{ if(gamecount < ps1[i].gamecount_point + 100){ for(int j = 0;j < ps1[i].max_bullet;j++){ ps1[i].x[j] += cos(ps1[i].angle[j]) * 8; ps1[i].y[j] += sin(ps1[i].angle[j]) * 8; } } else{ ps1[i].move_flag = 0; ps1[i].init_flag = 0; } } break; default: break; } } } } void my_set_enemy(){ for (int i = 0; i < STAGE_ENEMY_MAX; i++){ if (ary_enemy_data[stage_num][(i * ENEMY_DATA_MAX) + 1] == gamecount && gamecount > 0){ for (int j = 0; j < DISP_ENEMY_MAX; j++){ if (enemy[j].move_flag == 0){ enemy[j].move_flag = 1; enemy[j].serial_num = ary_enemy_data[stage_num][i * ENEMY_DATA_MAX]; enemy[j].appear_point = ary_enemy_data[stage_num][(i * ENEMY_DATA_MAX) + 1]; enemy[j].first_x = ary_enemy_data[stage_num][(i * ENEMY_DATA_MAX) + 2]; enemy[j].first_y = ary_enemy_data[stage_num][(i * ENEMY_DATA_MAX) + 3]; enemy[j].move_type = ary_enemy_data[stage_num][(i * ENEMY_DATA_MAX) + 4]; enemy[j].shot_type = ary_enemy_data[stage_num][(i * ENEMY_DATA_MAX) + 5]; enemy[j].power = ary_enemy_data[stage_num][(i * ENEMY_DATA_MAX) + 6]; enemy[j].range = ary_enemy_data[stage_num][(i * ENEMY_DATA_MAX) + 7]; enemy[j].item_flag = ary_enemy_data[stage_num][(i * ENEMY_DATA_MAX) + 8]; break; } } } } } void my_move_enemy(){ for (int i = 0; i < DISP_ENEMY_MAX; i++){ if (enemy[i].move_flag == 1){ switch (enemy[i].move_type){ case 0: if (enemy[i].init_flag == 0){ enemy[i].x = enemy[i].first_x; enemy[i].y = 260; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 500){ if (gamecount < enemy[i].gamecount_point + 220){ enemy[i].y--; } if (gamecount == enemy[i].gamecount_point + 240){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } if (gamecount > enemy[i].gamecount_point + 260){ enemy[i].y++; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 1: if (enemy[i].init_flag == 0){ enemy[i].x = 0; enemy[i].y = 260; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 600){ if (gamecount < enemy[i].gamecount_point + 260){ enemy[i].y--; } if (gamecount == enemy[i].gamecount_point + 280){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } if (gamecount > enemy[i].gamecount_point + 300){ enemy[i].x++; enemy[i].y = 1 * enemy[i].x; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 2: if (enemy[i].init_flag == 0){ enemy[i].x = 0; enemy[i].y = 260; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 600){ if (gamecount < enemy[i].gamecount_point + 260){ enemy[i].y--; } if (gamecount == enemy[i].gamecount_point + 280){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } if (gamecount > enemy[i].gamecount_point + 300){ enemy[i].x--; enemy[i].y = -1 * enemy[i].x; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 3: if (enemy[i].init_flag == 0){ enemy[i].x = 100; enemy[i].y = 260; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 500){ if (gamecount < enemy[i].gamecount_point + 260){ enemy[i].y--; } if (gamecount == enemy[i].gamecount_point + 270){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } if (gamecount > enemy[i].gamecount_point + 280){ enemy[i].x++; enemy[i].y = (2 * enemy[i].x) - 200; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 4: if (enemy[i].init_flag == 0){ enemy[i].x = -100; enemy[i].y = 260; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 500){ if (gamecount < enemy[i].gamecount_point + 260){ enemy[i].y--; } if (gamecount == enemy[i].gamecount_point + 270){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } if (gamecount > enemy[i].gamecount_point + 280){ enemy[i].x--; enemy[i].y = (-2 * enemy[i].x) - 200; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 5: if (enemy[i].init_flag == 0){ enemy[i].x = 0; enemy[i].y = 260; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 500){ if (gamecount < enemy[i].gamecount_point + 50){ enemy[i].x = enemy[i].x + 2; enemy[i].y = 6000 / enemy[i].x; } if (gamecount == enemy[i].gamecount_point + 60){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } if (gamecount > enemy[i].gamecount_point + 110){ enemy[i].x = enemy[i].x + 2; enemy[i].y = 6000 / enemy[i].x; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 6: if (enemy[i].init_flag == 0){ enemy[i].x = 0; enemy[i].y = 260; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 500){ if (gamecount < enemy[i].gamecount_point + 50){ enemy[i].x = enemy[i].x - 2; enemy[i].y = -6000 / enemy[i].x; } if (gamecount == enemy[i].gamecount_point + 60){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } if (gamecount > enemy[i].gamecount_point + 110){ enemy[i].x = enemy[i].x - 2; enemy[i].y = -6000 / enemy[i].x; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 7: if (enemy[i].init_flag == 0){ enemy[i].x = -155; enemy[i].y = 260; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 500){ if (gamecount < enemy[i].gamecount_point + 90){ enemy[i].x++; enemy[i].y = 0.01 * (enemy[i].x * enemy[i].x); } if (gamecount == enemy[i].gamecount_point + 100){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } if (gamecount > enemy[i].gamecount_point + 200){ enemy[i].x++; enemy[i].y = 0.01 * (enemy[i].x * enemy[i].x); } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 8: if (enemy[i].init_flag == 0){ enemy[i].x = 155; enemy[i].y = 260; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 500){ if (gamecount < enemy[i].gamecount_point + 90){ enemy[i].x--; enemy[i].y = 0.01 * (enemy[i].x * enemy[i].x); } if (gamecount == enemy[i].gamecount_point + 100){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } if (gamecount > enemy[i].gamecount_point + 200){ enemy[i].x--; enemy[i].y = 0.01 * (enemy[i].x * enemy[i].x); } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 9: if (enemy[i].init_flag == 0){ enemy[i].x = enemy[i].first_x; enemy[i].y = enemy[i].first_y; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 800){ if (key[KEY_INPUT_RIGHT] >= 1 && p1.x < RIGHT_LIMIT){ enemy[i].x -= 0.5f; } if (key[KEY_INPUT_LEFT] >= 1 && p1.x > LEFT_LIMIT){ enemy[i].x += 0.5f; } enemy[i].y -= back_img_speed; if (gamecount % 200 == 1){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 10: if (enemy[i].init_flag == 0){ enemy[i].x = enemy[i].first_x; enemy[i].y = 260; enemy[i].angle = 0; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 600){ if (gamecount < enemy[i].gamecount_point + 450){ enemy[i].angle += 2; enemy[i].x = (sin(enemy[i].angle * (DX_PI / 180)) * 100) + enemy[i].first_x; enemy[i].y -= 0.5f; } if (gamecount > enemy[i].gamecount_point + 450){ enemy[i].y += 4; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 11: if (enemy[i].init_flag == 0){ enemy[i].x = -220; enemy[i].y = 260; enemy[i].var[0] = rand() % 400; enemy[i].var[1] = rand() % 50; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 400){ enemy[i].x += 2; enemy[i].y = 0.02 * ((enemy[i].x + (200 - enemy[i].var[0])) * (enemy[i].x + (200 - enemy[i].var[0]))) - enemy[i].var[1]; if (enemy[i].x == (((int)(-(200 - enemy[i].var[0])) / 2)) * 2){ my_set_enemy_shot(enemy[i].x, enemy[i].y, enemy[i].shot_type,i); } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 12: if (enemy[i].init_flag == 0){ enemy[i].x = 220; enemy[i].y = 260; enemy[i].var[0] = rand() % 400; enemy[i].var[1] = rand() % 50; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 400){ enemy[i].x -= 2; enemy[i].y = 0.02 * ((enemy[i].x + (200 - enemy[i].var[0])) * (enemy[i].x + (200 - enemy[i].var[0]))) - enemy[i].var[1]; if (enemy[i].x == (((int)(-(200 - enemy[i].var[0])) / 2)) * 2){ my_set_enemy_shot(enemy[i].x, enemy[i].y, enemy[i].shot_type,i); } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 13: if (enemy[i].init_flag == 0){ enemy[i].x = enemy[i].first_x; enemy[i].y = 260; enemy[i].pattern = (rand() % 4) * 2; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 1200){ switch (enemy[i].pattern % 8){ case 0: enemy[i].x += 2; break; case 1: enemy[i].x -= 2; break; case 2: enemy[i].y += 2; break; case 3: enemy[i].y -= 2; break; case 4: enemy[i].x -= 2; break; case 5: enemy[i].x += 2; break; case 6: enemy[i].y -= 2; break; case 7: enemy[i].y += 2; break; default: break; } enemy[i].y -= 0.5f; if(gamecount % 20 == 1){ enemy[i].pattern++; } if ((gamecount - enemy[i].gamecount_point) % 200 == 1){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 14: if (enemy[i].init_flag == 0){ enemy[i].x = -220; enemy[i].y = -260; enemy[i].angle = atan2(p1.y - enemy[i].y, p1.x - enemy[i].x); enemy[i].pattern = 0; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 800){ if (gamecount < enemy[i].gamecount_point + 50){ enemy[i].x++; enemy[i].y = 0.1 * ((enemy[i].x + 220) * (enemy[i].x + 220)) - 240; } if (gamecount > enemy[i].gamecount_point + 50 && gamecount < enemy[i].gamecount_point + 500){ switch (enemy[i].pattern % 2){ case 0: enemy[i].x += cos(enemy[i].angle) * 2; enemy[i].y += sin(enemy[i].angle) * 2; break; case 1: break; default: break; } if (gamecount % 12 == 0){ enemy[i].pattern++; enemy[i].angle = atan2(p1.y - enemy[i].y, p1.x - enemy[i].x); } if ((gamecount - enemy[i].gamecount_point) % 200 == 1){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } } if (gamecount > enemy[i].gamecount_point + 500){ enemy[i].y += 4; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 15: if (enemy[i].init_flag == 0){ enemy[i].x = 220; enemy[i].y = -260; enemy[i].angle = atan2(p1.y - enemy[i].y, p1.x - enemy[i].x); enemy[i].pattern = 0; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 800){ if (gamecount < enemy[i].gamecount_point + 50){ enemy[i].x--; enemy[i].y = 0.1 * ((enemy[i].x - 220) * (enemy[i].x - 220)) - 240; } if (gamecount > enemy[i].gamecount_point + 50 && gamecount < enemy[i].gamecount_point + 500){ switch (enemy[i].pattern % 2){ case 0: enemy[i].x += cos(enemy[i].angle) * 2; enemy[i].y += sin(enemy[i].angle) * 2; break; case 1: break; default: break; } if (gamecount % 12 == 0){ enemy[i].pattern++; enemy[i].angle = atan2(p1.y - enemy[i].y, p1.x - enemy[i].x); } if (gamecount % 200 == 1){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); } } if (gamecount > enemy[i].gamecount_point + 500){ enemy[i].y += 4; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 16: if (enemy[i].init_flag == 0){ enemy[i].x = enemy[i].first_x; enemy[i].y = enemy[i].first_y; enemy[i].angle = atan2(p1.y - enemy[i].y, p1.x - enemy[i].x); enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 2000){ enemy[i].x += cos(enemy[i].angle) * 0.5f; enemy[i].y += sin(enemy[i].angle) * 0.5f; if (gamecount % 12 == 0){ enemy[i].angle = atan2(p1.y - enemy[i].y, p1.x - enemy[i].x); } if (gamecount > enemy[i].gamecount_point + 1000){ enemy[i].y--; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 17: if (enemy[i].init_flag == 0){ enemy[i].x = enemy[i].first_x; enemy[i].y = 280; enemy[i].var[0] = 0; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 3000){ if (gamecount < enemy[i].gamecount_point + 100){ enemy[i].y = 280 - (sin(DX_PI / 100 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 220; enemy[i].var[0]++; } if (gamecount > enemy[i].gamecount_point + 100 && gamecount < enemy[i].gamecount_point + 2900){ if (gamecount % 100 == 1){ enemy[i].var[0] = 0; enemy[i].var[1] = enemy[i].x; enemy[i].var[2] = enemy[i].y; enemy[i].pattern = (rand() % 8); if (enemy[i].x < -220){ enemy[i].pattern = 4; } else if (enemy[i].x > 220){ enemy[i].pattern = 5; } else if (enemy[i].y < -240){ enemy[i].pattern = 6; } else if (enemy[i].y > 240){ enemy[i].pattern = 7; } enemy[i].var[3] = 1; } if (enemy[i].var[3] == 1){ switch(enemy[i].pattern){ case 0: enemy[i].x = enemy[i].var[1] + ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); enemy[i].y = enemy[i].var[2] + ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); break; case 1: enemy[i].x = enemy[i].var[1] - ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); enemy[i].y = enemy[i].var[2] + ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); break; case 2: enemy[i].x = enemy[i].var[1] + ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); enemy[i].y = enemy[i].var[2] - ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); break; case 3: enemy[i].x = enemy[i].var[1] - ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); enemy[i].y = enemy[i].var[2] - ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); break; case 4: enemy[i].x = enemy[i].var[1] + ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); break; case 5: enemy[i].x = enemy[i].var[1] - ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); break; case 6: enemy[i].y = enemy[i].var[2] + ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); break; case 7: enemy[i].y = enemy[i].var[2] - ((sin(DX_PI / 50 * enemy[i].var[0] - (DX_PI * 0.5f)) + 1) / 2 * 80); break; default: break; } enemy[i].var[0]++; if (enemy[i].var[0] == 50){ my_set_enemy_shot(enemy[i].x,enemy[i].y,enemy[i].shot_type,i); enemy[i].var[3] = 0; } } } if (gamecount > enemy[i].gamecount_point + 2900){ enemy[i].y += 5; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 18: if (enemy[i].init_flag == 0){ enemy[i].x = enemy[i].first_x; enemy[i].y = enemy[i].first_y; enemy[i].m_y = -5; enemy[i].f_y = 0.9; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 1000){ if (gamecount < enemy[i].gamecount_point + 30){ enemy[i].y += enemy[i].m_y; } if (gamecount > enemy[i].gamecount_point + 30 && gamecount < enemy[i].gamecount_point + 60){ enemy[i].y += enemy[i].m_y; enemy[i].m_y *= enemy[i].f_y; } if (gamecount == enemy[i].gamecount_point + 60){ my_set_enemy_shot(enemy[i].x, enemy[i].y, enemy[i].shot_type, i); enemy[i].a_y = 0.1; } if (gamecount > enemy[i].gamecount_point + 80){ enemy[i].y += enemy[i].m_y; enemy[i].m_y += enemy[i].a_y; } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 19: if (enemy[i].init_flag == 0){ enemy[i].x = 0; enemy[i].y = 260; enemy[i].m_x = 0; enemy[i].m_y = -5; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 100){ if (gamecount < enemy[i].gamecount_point + 10){ enemy[i].x += enemy[i].m_x; enemy[i].y += enemy[i].m_y; } if (gamecount == enemy[i].gamecount_point + 10){ enemy[i].a_x = 0.1; enemy[i].a_y = 0.05; } if (gamecount > enemy[i].gamecount_point + 10 && gamecount){ enemy[i].x += enemy[i].m_x; enemy[i].y += enemy[i].m_y; enemy[i].m_x += enemy[i].a_x; enemy[i].m_y += enemy[i].a_y; } if (gamecount % 10 == 0){ my_set_enemy_shot(enemy[i].x, enemy[i].y, 2, i); } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; case 20: if (enemy[i].init_flag == 0){ enemy[i].x = 0; enemy[i].y = 260; enemy[i].m_x = 0; enemy[i].m_y = -5; enemy[i].gamecount_point = gamecount; enemy[i].init_flag = 1; } else{ if (gamecount < enemy[i].gamecount_point + 100){ if (gamecount < enemy[i].gamecount_point + 10){ enemy[i].x += enemy[i].m_x; enemy[i].y += enemy[i].m_y; } if (gamecount == enemy[i].gamecount_point + 10){ enemy[i].a_x = -0.1; enemy[i].a_y = 0.05; } if (gamecount > enemy[i].gamecount_point + 10 && gamecount){ enemy[i].x += enemy[i].m_x; enemy[i].y += enemy[i].m_y; enemy[i].m_x += enemy[i].a_x; enemy[i].m_y += enemy[i].a_y; } if (gamecount % 10 == 0){ my_set_enemy_shot(enemy[i].x, enemy[i].y, 2, i); } } else{ enemy[i].move_flag = 0; enemy[i].init_flag = 0; } } break; default: break; } } } } void my_set_enemy_shot(double x,double y,int shot_type,int enemy_num){ for(int i = 0;i < ENEMY_SHOT_MAX;i++){ if(enemy_shot[i].move_flag == 0){ enemy_shot[i].move_flag = 1; enemy_shot[i].first_x = x; enemy_shot[i].first_y = y; enemy_shot[i].move_type = shot_type; enemy_shot[i].enemy_num = enemy_num; break; } } } void my_move_enemy_shot(){ for(int i = 0;i < ENEMY_SHOT_MAX;i++){ if(enemy_shot[i].move_flag == 1){ switch(enemy_shot[i].move_type){ case 0: if (enemy_shot[i].init_flag == 0){ enemy_shot[i].x[0] = enemy_shot[i].first_x; enemy_shot[i].y[0] = enemy_shot[i].first_y; enemy_shot[i].max_bullet = 1; enemy_shot[i].gamecount_point[0] = gamecount; enemy_shot[i].init_flag = 1; } else{ if (gamecount < enemy_shot[i].gamecount_point[0] + 300){ enemy_shot[i].y[0] -= 2; } else{ enemy_shot[i].move_flag = 0; enemy_shot[i].init_flag = 0; } } break; case 1: if (enemy_shot[i].init_flag == 0){ enemy_shot[i].gamecount_point[0] = gamecount; enemy_shot[i].gamecount_point[1] = gamecount; enemy_shot[i].max_bullet = 1; for (int j = 0; j < 5; j++){ enemy_shot[i].x[j] = enemy_shot[i].first_x; enemy_shot[i].y[j] = enemy_shot[i].first_y; } enemy_shot[i].init_flag = 1; } else{ if (gamecount < enemy_shot[i].gamecount_point[0] + 500){ for (int j = 0; j < enemy_shot[i].max_bullet; j++){ enemy_shot[i].y[j] = enemy_shot[i].y[j] - 2; } if (enemy_shot[i].max_bullet < 5){ if (gamecount == enemy_shot[i].gamecount_point[1] + 5){ enemy_shot[i].max_bullet++; enemy_shot[i].gamecount_point[1] += 5; } } } else{ enemy_shot[i].move_flag = 0; enemy_shot[i].init_flag = 0; } } break; case 2: if (enemy_shot[i].init_flag == 0){ enemy_shot[i].gamecount_point[0] = gamecount; enemy_shot[i].max_bullet = 1; enemy_shot[i].x[0] = enemy_shot[i].first_x; enemy_shot[i].y[0] = enemy_shot[i].first_y; enemy_shot[i].angle[0] = atan2(p1.y - enemy_shot[i].first_y, p1.x - enemy_shot[i].first_x); enemy_shot[i].init_flag = 1; } else{ if (gamecount < enemy_shot[i].gamecount_point[0] + 400){ enemy_shot[i].x[0] += cos(enemy_shot[i].angle[0]) * 2; enemy_shot[i].y[0] += sin(enemy_shot[i].angle[0]) * 2; } else{ enemy_shot[i].move_flag = 0; enemy_shot[i].init_flag = 0; } } break; case 3: if (enemy_shot[i].init_flag == 0){ enemy_shot[i].gamecount_point[0] = gamecount; enemy_shot[i].gamecount_point[1] = gamecount; enemy_shot[i].max_bullet = 1; for (int j = 0; j < 10; j++){ enemy_shot[i].x[j] = enemy_shot[i].first_x; enemy_shot[i].y[j] = enemy_shot[i].first_y; } enemy_shot[i].angle[0] = atan2(p1.y - enemy_shot[i].first_y, p1.x - enemy_shot[i].first_x); enemy_shot[i].init_flag = 1; } else{ if (gamecount < enemy_shot[i].gamecount_point[0] + 500){ for (int j = 0; j < enemy_shot[i].max_bullet; j++){ enemy_shot[i].x[j] += cos(enemy_shot[i].angle[0]) * 4; enemy_shot[i].y[j] += sin(enemy_shot[i].angle[0]) * 4; } if (enemy_shot[i].max_bullet < 10){ if (gamecount == enemy_shot[i].gamecount_point[1] + 5 && enemy[enemy_shot[i].enemy_num].move_flag == 1){ enemy_shot[i].max_bullet++; enemy_shot[i].gamecount_point[1] += 5; } } } else{ enemy_shot[i].move_flag = 0; enemy_shot[i].init_flag = 0; } } break; case 4: if (enemy_shot[i].init_flag == 0){ enemy_shot[i].gamecount_point[0] = gamecount; enemy_shot[i].gamecount_point[1] = gamecount; enemy_shot[i].max_bullet = 1; for (int j = 0; j < 10; j++){ enemy_shot[i].x[j] = enemy_shot[i].first_x; enemy_shot[i].y[j] = enemy_shot[i].first_y; } enemy_shot[i].angle[0] = atan2(p1.y - enemy_shot[i].first_y, p1.x - enemy_shot[i].first_x); enemy_shot[i].init_flag = 1; } else{ if (gamecount < enemy_shot[i].gamecount_point[0] + 500){ for (int j = 0; j < enemy_shot[i].max_bullet; j++){ enemy_shot[i].x[j] += cos(enemy_shot[i].angle[j]) * 4; enemy_shot[i].y[j] += sin(enemy_shot[i].angle[j]) * 4; } if (enemy_shot[i].max_bullet < 10){ if (gamecount == enemy_shot[i].gamecount_point[1] + 10 && enemy[enemy_shot[i].enemy_num].move_flag == 1){ enemy_shot[i].angle[enemy_shot[i].max_bullet] = atan2(p1.y - enemy_shot[i].first_y, p1.x - enemy_shot[i].first_x); enemy_shot[i].max_bullet++; enemy_shot[i].gamecount_point[1] += 10; } } } else{ enemy_shot[i].move_flag = 0; enemy_shot[i].init_flag = 0; } } break; case 5: if (enemy_shot[i].init_flag == 0){ enemy_shot[i].gamecount_point[0] = gamecount; enemy_shot[i].gamecount_point[1] = gamecount; enemy_shot[i].max_bullet = 1; for (int j = 0; j < 5; j++){ enemy_shot[i].x[j] = enemy_shot[i].first_x; enemy_shot[i].y[j] = enemy_shot[i].first_y; } int tmp = 245; for (int j = 0; j < 5; j++){ enemy_shot[i].angle[j] = tmp * (DX_PI / 180); tmp += 10; } enemy_shot[i].init_flag = 1; } else{ if (gamecount < enemy_shot[i].gamecount_point[0] + 500){ for (int j = 0; j < enemy_shot[i].max_bullet; j++){ enemy_shot[i].x[j] += cos(enemy_shot[i].angle[j]) * 5; enemy_shot[i].y[j] += sin(enemy_shot[i].angle[j]) * 5; } if (enemy_shot[i].max_bullet < 5){ if (gamecount == enemy_shot[i].gamecount_point[1] + 5 && enemy[enemy_shot[i].enemy_num].move_flag == 1){ enemy_shot[i].max_bullet++; enemy_shot[i].gamecount_point[1] += 5; } } } else{ enemy_shot[i].move_flag = 0; enemy_shot[i].init_flag = 0; } } break; default: break; } } } } void my_set_boss(){ for (int i = 0; i < STAGE_BOSS_MAX; i++){ if (ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 1] == gamecount && gamecount > 0){ for (int j = 0; j < DISP_BOSS_MAX; j++){ if (boss[j].move_flag == 0){ boss[j].move_flag = 1; boss[j].serial_num = ary_boss_data[stage_num][i * BOSS_DATA_MAX]; boss[j].appear_point = ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 1]; boss[j].first_x = ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 2]; boss[j].first_y = ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 3]; boss[j].move_type = ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 4]; boss[j].shot_type = ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 5]; boss[j].power = ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 6]; boss[j].range = ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 7]; boss[j].item_flag = ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 8]; boss[j].end_flag = ary_boss_data[stage_num][(i * BOSS_DATA_MAX) + 9]; break; } } } } } void my_move_boss(){ for (int i = 0; i < DISP_BOSS_MAX; i++){ if (boss[i].move_flag == 1){ switch (boss[i].move_type){ case 0: if (boss[i].init_flag == 0){ boss[i].x = boss[i].first_x; boss[i].y = 260; boss[i].damage_flag = 0; boss[i].gamecount_point[0] = gamecount; boss[i].init_flag = 1; } else{ if (gamecount < boss[i].gamecount_point[0] + 3000){ if(boss[i].power > 0){ if (gamecount < boss[i].gamecount_point[0] + 260){ boss[i].y--; } if (gamecount == boss[i].gamecount_point[0] + 260){ boss[i].damage_flag = 1; } if(gamecount == boss[i].gamecount_point[0] + 280){ my_set_boss_shot(boss[i].x,boss[i].y,boss[i].shot_type,i); } if (gamecount > boss[i].gamecount_point[0] + 840){ boss[i].y++; } } } else{ boss[i].move_flag = 0; boss[i].init_flag = 0; } } break; case 1: if (boss[i].init_flag == 0){ boss[i].x = boss[i].first_x; boss[i].y = 260; boss[i].damage_flag = 0; boss[i].gamecount_point[0] = gamecount; boss[i].init_flag = 1; } else{ if(boss[i].power > 0){ if (gamecount < boss[i].gamecount_point[0] + 220){ boss[i].y--; } if (gamecount == boss[i].gamecount_point[0] + 220){ boss[i].damage_flag = 1; } if (gamecount > boss[i].gamecount_point[0] + 240){ if(gamecount % 100 == 1){ my_set_enemy_shot(boss[i].x,boss[i].y,boss[i].shot_type,i); } } } } break; case 2: if (boss[i].init_flag == 0){ boss[i].x = 0; boss[i].y = 260; boss[i].var[0] = 0; boss[i].damage_flag = 0; boss[i].gamecount_point[0] = gamecount; boss[i].init_flag = 1; } else{ if(boss[i].power > 0){ if (gamecount < boss[i].gamecount_point[0] + 260){ boss[i].y--; } if (gamecount == boss[i].gamecount_point[0] + 260){ boss[i].damage_flag = 1; } if (gamecount > boss[i].gamecount_point[0] + 260){ boss[i].y = sin(boss[i].var[0] * (DX_PI / 180)) * 10; boss[i].var[0] += 2; if (gamecount >= boss[i].gamecount_point[0] + 360){ if((gamecount - (boss[i].gamecount_point[0] + 360)) % 900 == 0){ my_set_boss_shot(boss[i].x,boss[i].y,boss[i].shot_type,i); } } } } } break; case 3: if (boss[i].init_flag == 0){ boss[i].var[0] = boss[i].first_x; boss[i].var[1] = 260; boss[i].var[2] = 90; boss[i].x = boss[i].var[0] + cos(((DX_PI * 2) / 360) * boss[i].var[2]) * 100; boss[i].y = boss[i].var[1] + sin(((DX_PI * 2) / 360) * boss[i].var[2]) * 100; boss[i].damage_flag = 0; boss[i].gamecount_point[0] = gamecount; boss[i].init_flag = 1; } else{ if(boss[i].power > 0){ if (gamecount < boss[i].gamecount_point[0] + 260){ boss[i].var[1]--; } if (gamecount == boss[i].gamecount_point[0] + 260){ boss[i].damage_flag = 1; } if (gamecount > boss[i].gamecount_point[0] + 260){ if (gamecount % 400 == 1){ my_set_boss_shot(boss[i].x,boss[i].y,boss[i].shot_type,i); } } boss[i].x = boss[i].var[0] + cos(((DX_PI * 2) / 360) * boss[i].var[2]) * 100; boss[i].y = boss[i].var[1] + sin(((DX_PI * 2) / 360) * boss[i].var[2]) * 100; boss[i].var[2]++; } } break; case 4: if (boss[i].init_flag == 0){ boss[i].x = boss[i].first_x; boss[i].y = boss[i].first_y; boss[i].angle = 0; boss[i].var[0] = 0; boss[i].var[1] = boss[i].first_y; boss[i].damage_flag = 0; boss[i].gamecount_point[0] = gamecount; boss[i].gamecount_point[1] = gamecount + 260; boss[i].init_flag = 1; } else{ if(boss[i].power > 0){ if (gamecount < boss[i].gamecount_point[0] + 260){ boss[i].y--; boss[i].var[1]--; } if (gamecount == boss[i].gamecount_point[0] + 260){ boss[i].damage_flag = 1; } if (gamecount > boss[i].gamecount_point[1] && gamecount < boss[i].gamecount_point[1] + 550){ boss[i].y = boss[i].var[1] + sin(boss[i].var[0] * (DX_PI / 180)) * 10; boss[i].var[0] += 2; } if (gamecount == boss[i].gamecount_point[1] + 10){ my_set_boss_shot(boss[i].x,boss[i].y,boss[i].shot_type,i); } if (gamecount == boss[i].gamecount_point[1] + 550){ boss[i].angle = atan2(p1.y, p1.x); } if (gamecount > boss[i].gamecount_point[1] + 550 && gamecount < boss[i].gamecount_point[1] + 600){ boss[i].x += cos(boss[i].angle) * 4; boss[i].y += sin(boss[i].angle) * 4; } if (gamecount > boss[i].gamecount_point[1] + 600 && gamecount < boss[i].gamecount_point[1] + 700){ boss[i].x -= cos(boss[i].angle) * 2; boss[i].y -= sin(boss[i].angle) * 2; } if (gamecount == boss[i].gamecount_point[1] + 700){ boss[i].x = boss[i].first_x; boss[i].y = boss[i].first_y - 260; boss[i].var[0] = 0; } if (gamecount > boss[i].gamecount_point[1] + 700 && gamecount < boss[i].gamecount_point[1] + 900){ boss[i].y = boss[i].var[1] + sin(boss[i].var[0] * (DX_PI / 180)) * 10; boss[i].var[0] += 2; } if (gamecount == boss[i].gamecount_point[1] + 900){ boss[i].gamecount_point[1] += 900; } } } break; default: break; } } } } void my_set_boss_shot(double x,double y,int shot_type,int boss_num){ for(int i = 0;i < BOSS_SHOT_MAX;i++){ if(boss_shot[i].move_flag == 0){ boss_shot[i].move_flag = 1; boss_shot[i].first_x = x; boss_shot[i].first_y = y; boss_shot[i].move_type = shot_type; boss_shot[i].boss_num = boss_num; break; } } } void my_move_boss_shot(){ for(int i = 0;i < BOSS_SHOT_MAX;i++){ if(boss_shot[i].move_flag == 1){ switch(boss_shot[i].move_type){ case 0: if (boss_shot[i].init_flag == 0){ boss_shot[i].gamecount_point[0] = gamecount; boss_shot[i].gamecount_point[1] = gamecount; boss_shot[i].max_bullet = 1; for (int j = 0; j < 200; j++){ boss_shot[i].x[j] = boss_shot[i].first_x; boss_shot[i].y[j] = boss_shot[i].first_y; } for (int j = 0; j < 200; j++){ boss_shot[i].angle[j] = ((rand() % 360) * (DX_PI / 180)); } for (int j = 0; j < 200; j++){ boss_shot[i].var[j] = (rand() % 5) + 1; } boss_shot[i].init_flag = 1; } else{ if (gamecount < boss_shot[i].gamecount_point[0] + 800){ for (int j = 0; j < boss_shot[i].max_bullet; j++){ boss_shot[i].x[j] += cos(boss_shot[i].angle[j]) * boss_shot[i].var[j]; boss_shot[i].y[j] += sin(boss_shot[i].angle[j]) * boss_shot[i].var[j]; } if (gamecount == boss_shot[i].gamecount_point[1] + 2 && boss[boss_shot[i].boss_num].move_flag == 1){ if (boss_shot[i].max_bullet < 200){ boss_shot[i].max_bullet++; boss_shot[i].gamecount_point[1] += 2; } } } else{ boss_shot[i].move_flag = 0; boss_shot[i].init_flag = 0; } } break; case 1: if (boss_shot[i].init_flag == 0){ boss_shot[i].gamecount_point[0] = gamecount; boss_shot[i].gamecount_point[1] = gamecount; boss_shot[i].max_bullet = 40; for (int j = 0; j < 20; j++){ boss_shot[i].angle[j] = (18 * j) * DX_PI / 180; boss_shot[i].angle[j + 20] = (18 * j) * DX_PI / 180; boss_shot[i].angle2[j] = ((18 * j) + 4) * DX_PI / 180; boss_shot[i].angle2[j + 20] = ((18 * j) - 4) * DX_PI / 180; } for (int j = 0; j < 300; j++){ boss_shot[i].x[j] = 0; boss_shot[i].y[j] = 0; } boss_shot[i].init_flag = 1; } else{ if (gamecount < boss_shot[i].gamecount_point[0] + 900){ for (int j = 0; j < boss_shot[i].max_bullet; j++){ if (boss_shot[i].x[j] < 80 && boss_shot[i].x[j] > -80 && boss_shot[i].y[j] < 80 && boss_shot[i].y[j] > -80){ boss_shot[i].x[j] += cos(boss_shot[i].angle[j % 40]) * 1; boss_shot[i].y[j] += sin(boss_shot[i].angle[j % 40]) * 1; } else{ boss_shot[i].x[j] += cos(boss_shot[i].angle2[j % 40]) * 1; boss_shot[i].y[j] += sin(boss_shot[i].angle2[j % 40]) * 1; } } if (gamecount == boss_shot[i].gamecount_point[1] + 80 && boss[boss_shot[i].boss_num].move_flag == 1){ if (boss_shot[i].max_bullet < 280){ boss_shot[i].max_bullet += 40; boss_shot[i].gamecount_point[1] += 80; } } } else{ boss_shot[i].move_flag = 0; boss_shot[i].init_flag = 0; } } break; case 2: if (boss_shot[i].init_flag == 0){ boss_shot[i].gamecount_point[0] = gamecount; boss_shot[i].gamecount_point[1] = gamecount; boss_shot[i].max_bullet = 12; int angle[12] = {270,240,300,210,330,180,0,150,30,120,60,90}; for (int j = 0; j < 12; j++){ boss_shot[i].angle[j] = angle[j] * (DX_PI / 180); } for (int k = 0; k < 12; k++){ for (int j = 0; j < 12; j++){ boss_shot[i].x[j + (k * 12)] = cos(boss_shot[i].angle[k]) * 150; boss_shot[i].y[j + (k * 12)] = sin(boss_shot[i].angle[k]) * 150; } } boss_shot[i].init_flag = 1; } else{ if (gamecount < boss_shot[i].gamecount_point[0] + 800){ for (int j = 0; j < boss_shot[i].max_bullet; j++){ boss_shot[i].x[j] += cos(boss_shot[i].angle[j % 12]) * 1; boss_shot[i].y[j] += sin(boss_shot[i].angle[j % 12]) * 1; } if (gamecount == boss_shot[i].gamecount_point[1] + 50 && boss[boss_shot[i].boss_num].move_flag == 1){ if (boss_shot[i].max_bullet < 132){ boss_shot[i].max_bullet += 24; boss_shot[i].gamecount_point[1] += 50; } else if (boss_shot[i].max_bullet == 132){ boss_shot[i].max_bullet += 12; } } } else{ boss_shot[i].move_flag = 0; boss_shot[i].init_flag = 0; } } break; case 3: if (boss_shot[i].init_flag == 0){ boss_shot[i].gamecount_point[0] = gamecount; boss_shot[i].gamecount_point[1] = gamecount; boss_shot[i].max_bullet = 1; for (int j = 0; j < 5; j++){ boss_shot[i].x[j] = boss_shot[i].first_x; boss_shot[i].y[j] = boss_shot[i].first_y; } boss_shot[i].angle[0] = atan2(p1.y - boss_shot[i].first_y, p1.x - boss_shot[i].first_x); boss_shot[i].init_flag = 1; } else{ if (gamecount < boss_shot[i].gamecount_point[0] + 500){ for (int j = 0; j < boss_shot[i].max_bullet; j++){ boss_shot[i].x[j] += cos(boss_shot[i].angle[0]) * 4; boss_shot[i].y[j] += sin(boss_shot[i].angle[0]) * 4; } if (boss_shot[i].max_bullet < 5){ if (gamecount == boss_shot[i].gamecount_point[1] + 5 && boss[boss_shot[i].boss_num].move_flag == 1){ boss_shot[i].max_bullet++; boss_shot[i].gamecount_point[1] += 5; } } } else{ boss_shot[i].move_flag = 0; boss_shot[i].init_flag = 0; } } break; default: break; } } } } void my_set_exp_effect(double x,double y,int exp_type){ for(int i = 0;i < EXP_EFFECT_MAX;i++){ if(exp_effect[i].move_flag == 0){ exp_effect[i].move_flag = 1; exp_effect[i].first_x = x; exp_effect[i].first_y = y; exp_effect[i].move_type = exp_type; break; } } } void my_move_exp_effect(){ for(int i = 0;i < EXP_EFFECT_MAX;i++){ if(exp_effect[i].move_flag == 1){ switch(exp_effect[i].move_type){ case 0: if (exp_effect[i].init_flag == 0){ exp_effect[i].x = exp_effect[i].first_x; exp_effect[i].y = exp_effect[i].first_y; exp_effect[i].gamecount_point = gamecount; exp_effect[i].init_flag = 1; } else{ if (gamecount < exp_effect[i].gamecount_point + 2){ } else{ exp_effect[i].move_flag = 0; exp_effect[i].init_flag = 0; } } break; case 1: if (exp_effect[i].init_flag == 0){ exp_effect[i].x = exp_effect[i].first_x; exp_effect[i].y = exp_effect[i].first_y; exp_effect[i].gamecount_point = gamecount; exp_effect[i].init_flag = 1; } else{ if (gamecount < exp_effect[i].gamecount_point + 30){ } else{ exp_effect[i].move_flag = 0; exp_effect[i].init_flag = 0; } } break; case 2: if (exp_effect[i].init_flag == 0){ exp_effect[i].x = exp_effect[i].first_x; exp_effect[i].y = exp_effect[i].first_y; exp_effect[i].gamecount_point = gamecount; exp_effect[i].init_flag = 1; } else{ if (gamecount < exp_effect[i].gamecount_point + 200){ if(gamecount % 10 == 1){ int ran = (rand() % 5); int ran2 = (rand() % 5); int ary[5] = {-20,-10,0,10,20}; exp_effect[i].x = exp_effect[i].first_x + ary[ran]; exp_effect[i].y = exp_effect[i].first_y + ary[ran2]; my_play_se_sound(2); } } else{ exp_effect[i].move_flag = 0; exp_effect[i].init_flag = 0; } } break; default: break; } } } } void my_set_item(double x,double y,int item_type){ for(int i = 0;i < ITEM_MAX;i++){ if(item[i].move_flag == 0){ item[i].move_flag = 1; item[i].first_x = x; item[i].first_y = y; item[i].move_type = item_type; break; } } } void my_move_item(){ for(int i = 0;i < ITEM_MAX;i++){ if(item[i].move_flag == 1){ switch(item[i].move_type){ case 0: if (item[i].init_flag == 0){ item[i].x = item[i].first_x; item[i].y = item[i].first_y; item[i].gamecount_point = gamecount; item[i].init_flag = 1; } else{ if (gamecount < item[i].gamecount_point + 240){ item[i].y -= 2; } else{ item[i].move_flag = 0; item[i].init_flag = 0; } } break; case 1: if (item[i].init_flag == 0){ item[i].x = item[i].first_x; item[i].y = item[i].first_y; item[i].m_y = 5; item[i].a_y = -0.15; item[i].gamecount_point = gamecount; item[i].init_flag = 1; } else{ if (gamecount < item[i].gamecount_point + 240){ item[i].y += item[i].m_y; item[i].m_y += item[i].a_y; } else{ item[i].move_flag = 0; item[i].init_flag = 0; } } break; default: break; } } } } void my_set_barrier(){ barrier1.move_flag = 1; barrier1.power = 30; } void my_move_barrier(){ if(barrier1.move_flag == 1){ if (barrier1.init_flag == 0){ barrier1.x = p1.x + cos(((DX_PI * 2) / 10) * gamecount) * 20; barrier1.y = p1.y + sin(((DX_PI * 2) / 10) * gamecount) * 20; barrier1.init_flag = 1; } else{ barrier1.x = p1.x + cos(((DX_PI * 2) / 10) * gamecount) * 20; barrier1.y = p1.y + sin(((DX_PI * 2) / 10) * gamecount) * 20; } } } void my_set_bomb(){ if(bomb1.move_flag == 0){ bomb1.move_flag = 1; p1.bomb--; } } void my_move_bomb(){ if(bomb1.move_flag == 1){ if(bomb1.init_flag == 0){ bomb1.count = 0; bomb1.flag = 0; bomb1.init_flag = 1; } else{ if(bomb1.count < 10){ bomb1.count++; if(bomb1.count % 2 == 0){ bomb1.flag = 1; } else{ bomb1.flag = 0; } } else{ bomb1.move_flag = 0; bomb1.init_flag = 0; } } } } int my_pythago_theorem(double x,double x2,double y,double y2,double range,double range2){ double x3 = x - x2; double y3 = y - y2; double range3 = range + range2; if (x3 * x3 + y3 * y3 < range3 * range3){ return 1; } else{ return 0; } } void my_collision_detection(){ my_collision_player_enemy(); my_collision_player_shot_enemy(); my_collision_player_enemy_shot(); my_collision_player_boss(); my_collision_player_shot_boss(); my_collision_player_boss_shot(); my_collision_player_item(); my_collision_barrier_enemy(); my_collision_barrier_enemy_shot(); my_collision_barrier_boss(); my_collision_barrier_boss_shot(); my_collision_bomb_enemy(); my_collision_bomb_enemy_shot(); my_check_player_power(); my_check_enemy_power(); my_check_boss_power(); my_check_barrier_power(); } void my_collision_player_enemy(){ for(int i = 0;i < DISP_ENEMY_MAX;i++){ if(enemy[i].move_flag == 1 && enemy[i].init_flag == 1 && p1.power > 0 && barrier1.move_flag == 0){ if(my_pythago_theorem(p1.x,enemy[i].x, p1.y,enemy[i].y,p1.range,enemy[i].range)){ p1.power--; enemy[i].power--; my_set_exp_effect(enemy[i].x,enemy[i].y,0); } } } } void my_collision_player_shot_enemy(){ for(int i = 0;i < DISP_ENEMY_MAX;i++){ if(enemy[i].move_flag == 1 && enemy[i].init_flag == 1){ for(int j = 0;j < PLAYER_SHOT_MAX;j++){ if(ps1[j].move_flag == 1 && ps1[j].init_flag == 1){ for(int k = 0;k < ps1[j].max_bullet;k++){ if(ps1[j].flag[k] == 1 && ps1[j].x[k] > LEFT_LIMIT && ps1[j].x[k] < RIGHT_LIMIT && ps1[j].y[k] > BOTTOM_LIMIT && ps1[j].y[k] < TOP_LIMIT){ if(my_pythago_theorem(enemy[i].x,ps1[j].x[k], enemy[i].y,ps1[j].y[k],enemy[i].range,ps1[j].range)){ enemy[i].power--; ps1[j].flag[k] = 0; my_set_exp_effect(enemy[i].x,enemy[i].y,0); my_play_se_sound(4); } } } } } } } } void my_collision_player_enemy_shot(){ for(int i = 0;i < ENEMY_SHOT_MAX;i++){ if(enemy_shot[i].move_flag == 1 && enemy_shot[i].init_flag == 1 && p1.power > 0 && barrier1.move_flag == 0){ for(int j = 0;j < enemy_shot[i].max_bullet;j++){ if(my_pythago_theorem(p1.x,enemy_shot[i].x[j], p1.y,enemy_shot[i].y[j],p1.range,enemy_shot[i].range)){ p1.power--; my_set_exp_effect(p1.x,p1.y,0); } } } } } void my_collision_player_boss(){ for(int i = 0;i < DISP_BOSS_MAX;i++){ if(boss[i].move_flag == 1 && boss[i].init_flag == 1 && p1.power > 0 && barrier1.move_flag == 0){ if(my_pythago_theorem(p1.x,boss[i].x, p1.y,boss[i].y,p1.range,boss[i].range)){ p1.power--; if(boss[i].damage_flag == 1){ boss[i].power--; } my_set_exp_effect(boss[i].x,boss[i].y,0); } } } } void my_collision_player_shot_boss(){ for(int i = 0;i < DISP_BOSS_MAX;i++){ if(boss[i].move_flag == 1 && boss[i].init_flag == 1){ for(int j = 0;j < PLAYER_SHOT_MAX;j++){ if(ps1[j].move_flag == 1 && ps1[j].init_flag == 1){ for(int k = 0;k < ps1[j].max_bullet;k++){ if(ps1[j].flag[k] == 1 && ps1[j].x[k] > LEFT_LIMIT && ps1[j].x[k] < RIGHT_LIMIT && ps1[j].y[k] > BOTTOM_LIMIT && ps1[j].y[k] < TOP_LIMIT){ if(my_pythago_theorem(boss[i].x,ps1[j].x[k], boss[i].y,ps1[j].y[k],boss[i].range,ps1[j].range)){ if(boss[i].damage_flag == 1){ boss[i].power--; } ps1[j].flag[k] = 0; my_set_exp_effect(boss[i].x,boss[i].y,0); my_play_se_sound(4); } } } } } } } } void my_collision_player_boss_shot(){ for(int i = 0;i < BOSS_SHOT_MAX;i++){ if(boss_shot[i].move_flag == 1 && boss_shot[i].init_flag == 1 && p1.power > 0 && barrier1.move_flag == 0){ for(int j = 0;j < boss_shot[i].max_bullet;j++){ if(my_pythago_theorem(p1.x,boss_shot[i].x[j], p1.y,boss_shot[i].y[j],p1.range,boss_shot[i].range)){ p1.power--; my_set_exp_effect(p1.x,p1.y,0); } } } } } void my_collision_player_item(){ for(int i = 0;i < ITEM_MAX;i++){ if(item[i].move_flag == 1 && item[i].init_flag == 1 && p1.power > 0){ if(my_pythago_theorem(p1.x,item[i].x, p1.y,item[i].y,p1.range,item[i].range)){ item[i].move_flag = 0; item[i].init_flag = 0; if(p1.shot_type < 2){ p1.shot_type++; } else if(p1.shot_type == 2){ my_set_barrier(); } my_play_se_sound(3); } } } } void my_collision_barrier_enemy(){ for(int i = 0;i < DISP_ENEMY_MAX;i++){ if(enemy[i].move_flag == 1 && enemy[i].init_flag == 1 && barrier1.power > 0){ if(barrier1.move_flag == 1 && barrier1.init_flag == 1){ if(my_pythago_theorem(barrier1.x,enemy[i].x, barrier1.y,enemy[i].y,barrier1.range,enemy[i].range)){ barrier1.power--; enemy[i].power--; my_play_se_sound(4); } } } } } void my_collision_barrier_enemy_shot(){ for(int i = 0;i < ENEMY_SHOT_MAX;i++){ if(enemy_shot[i].move_flag == 1 && enemy_shot[i].init_flag == 1 && barrier1.power > 0){ for(int j = 0;j < enemy_shot[i].max_bullet;j++){ if(barrier1.move_flag == 1 && barrier1.init_flag == 1){ if(my_pythago_theorem(barrier1.x,enemy_shot[i].x[j], barrier1.y,enemy_shot[i].y[j],barrier1.range,enemy_shot[i].range)){ barrier1.power--; my_play_se_sound(4); } } } } } } void my_collision_barrier_boss(){ for(int i = 0;i < DISP_BOSS_MAX;i++){ if(boss[i].move_flag == 1 && boss[i].init_flag == 1 && barrier1.power > 0){ if(barrier1.move_flag == 1 && barrier1.init_flag == 1){ if(my_pythago_theorem(barrier1.x,boss[i].x, barrier1.y,boss[i].y,barrier1.range,boss[i].range)){ barrier1.power--; if(boss[i].damage_flag == 1){ boss[i].power--; } my_play_se_sound(4); } } } } } void my_collision_barrier_boss_shot(){ for(int i = 0;i < BOSS_SHOT_MAX;i++){ if(boss_shot[i].move_flag == 1 && boss_shot[i].init_flag == 1 && barrier1.power > 0){ for(int j = 0;j < boss_shot[i].max_bullet;j++){ if(barrier1.move_flag == 1 && barrier1.init_flag == 1){ if(my_pythago_theorem(barrier1.x,boss_shot[i].x[j], barrier1.y,boss_shot[i].y[j],barrier1.range,boss_shot[i].range)){ barrier1.power--; my_play_se_sound(4); } } } } } } void my_collision_bomb_enemy(){ for(int i = 0;i < DISP_ENEMY_MAX;i++){ if(enemy[i].move_flag == 1 && enemy[i].init_flag == 1){ if(bomb1.move_flag == 1 && bomb1.init_flag == 1){ if(bomb1.flag == 1){ enemy[i].power--; } } } } } void my_collision_bomb_enemy_shot(){ for(int i = 0;i < ENEMY_SHOT_MAX;i++){ if(enemy_shot[i].move_flag == 1 && enemy_shot[i].init_flag == 1){ if(bomb1.move_flag == 1 && bomb1.init_flag == 1){ if(bomb1.flag == 1){ enemy_shot[i].move_flag = 0; enemy_shot[i].init_flag = 0; } } } } } void my_check_player_power(){ if(p1.power <= 0 && gameover_flag == 0){ my_set_exp_effect(p1.x,p1.y,1); gameover_flag = 1; my_play_se_sound(2); } } void my_check_enemy_power(){ for(int i = 0;i < DISP_ENEMY_MAX;i++){ if(enemy[i].move_flag == 1 && enemy[i].init_flag == 1){ if(enemy[i].power <= 0){ enemy[i].move_flag = 0; enemy[i].init_flag = 0; my_set_exp_effect(enemy[i].x,enemy[i].y,1); if(enemy[i].item_flag == 1){ my_set_item(enemy[i].x,enemy[i].y,1); } score += 10; my_play_se_sound(2); } } } } void my_check_boss_power(){ for(int i = 0;i < DISP_BOSS_MAX;i++){ if(boss[i].move_flag == 1 && boss[i].init_flag == 1){ if(boss[i].power <= 0){ gamecount2++; if(gamecount2 == 1){ my_set_exp_effect(boss[i].x,boss[i].y,2); } else if(gamecount2 == 200){ boss[i].move_flag = 0; boss[i].init_flag = 0; if(boss[i].end_flag == 1){ gameclear_flag = 1; } gamecount2 = 0; score += 1000; } } } } } void my_check_barrier_power(){ if(barrier1.power <= 0){ barrier1.move_flag = 0; barrier1.init_flag = 0; } } void my_change_state(){ if(gameover_flag == 1){ gamecount3++; if(gamecount3 == 200){ if(p1.life == 1){ game_state = 2; } else{ p1.life--; p1.shot_type = 0; game_state = 5; } } } else if(gameclear_flag == 1){ stage_num++; gamecount = 0; game_state = 25; } } void my_to_center(){ p1.draw_x = p1.x + 220; p1.draw_y = ((-1) * p1.y) + 240; for(int i = 0;i < PLAYER_SHOT_MAX;i++){ if(ps1[i].move_flag == 1 && ps1[i].init_flag == 1){ for(int j = 0;j < ps1[i].max_bullet;j++){ ps1[i].draw_x[j] = ps1[i].x[j] + 220; ps1[i].draw_y[j] = ((-1) * ps1[i].y[j]) + 240; } } } for (int i = 0; i < DISP_ENEMY_MAX; i++){ if (enemy[i].move_flag == 1 && enemy[i].init_flag == 1){ enemy[i].draw_x = enemy[i].x + 220; enemy[i].draw_y = ((-1) * enemy[i].y) + 240; } } for(int i = 0;i < ENEMY_SHOT_MAX;i++){ if(enemy_shot[i].move_flag == 1 && enemy_shot[i].init_flag == 1){ for(int j = 0;j < enemy_shot[i].max_bullet;j++){ enemy_shot[i].draw_x[j] = enemy_shot[i].x[j] + 220; enemy_shot[i].draw_y[j] = ((-1) * enemy_shot[i].y[j]) + 240; } } } for (int i = 0; i < DISP_BOSS_MAX; i++){ if (boss[i].move_flag == 1 && boss[i].init_flag == 1){ boss[i].draw_x = boss[i].x + 220; boss[i].draw_y = ((-1) * boss[i].y) + 240; } } for(int i = 0;i < BOSS_SHOT_MAX;i++){ if(boss_shot[i].move_flag == 1 && boss_shot[i].init_flag == 1){ for(int j = 0;j < boss_shot[i].max_bullet;j++){ boss_shot[i].draw_x[j] = boss_shot[i].x[j] + 220; boss_shot[i].draw_y[j] = ((-1) * boss_shot[i].y[j]) + 240; } } } for (int i = 0;i < EXP_EFFECT_MAX;i++){ if (exp_effect[i].move_flag == 1 && exp_effect[i].init_flag == 1){ exp_effect[i].draw_x = exp_effect[i].x + 220; exp_effect[i].draw_y = ((-1) * exp_effect[i].y) + 240; } } for (int i = 0;i < ITEM_MAX;i++){ if (item[i].move_flag == 1 && item[i].init_flag == 1){ item[i].draw_x = item[i].x + 220; item[i].draw_y = ((-1) * item[i].y) + 240; } } if(barrier1.move_flag == 1 && barrier1.init_flag == 1){ barrier1.draw_x = barrier1.x + 220; barrier1.draw_y = ((-1) * barrier1.y) + 240; } } void my_calc_img(){ switch(game_state){ case 15: player_img_count = gamecount % 4; break; case 20: player_img_count = gamecount % 4; if(gamecount % 2 == 1){ boss_img_count++; boss_img_count %= 2; } break; case 25: player_img_count = gamecount % 4; break; default: break; } } void my_draw_op(){ DrawGraph(0, 0, op_img, TRUE); DrawFormatString(480 - (GetDrawFormatStringWidth("‚bŒ¾Œê“ü–å") / 2), 220, Color_White, "‚bŒ¾Œê“ü–å"); DrawFormatString(480 - (GetDrawFormatStringWidth("‚r‚s‚f‚̍ì‚è•û") / 2), 240, Color_White, "‚r‚s‚f‚̍ì‚è•û"); DrawFormatString(480 - (GetDrawFormatStringWidth("press enter to start") / 2), 260, Color_White, "press enter to start"); DrawFormatString(320 - (GetDrawFormatStringWidth("‘€ì•û–@@ˆÚ“®:–îˆóƒL[@ƒVƒ‡ƒbƒg:‚yƒL[@ƒ{ƒ€:‚wƒL[") / 2), 460, Color_White, "‘€ì•û–@@ˆÚ“®:–îˆóƒL[@ƒVƒ‡ƒbƒg:‚yƒL[@ƒ{ƒ€:‚wƒL["); } void my_draw_ed(){ DrawGraph(0, 0, ed_img, TRUE); DrawFormatString(480 - (GetDrawFormatStringWidth("Congratulations!!!") / 2), 40, Color_White, "Congratulations!!!"); DrawFormatString(480 - (GetDrawFormatStringWidth("‚bŒ¾Œê“ü–å") / 2), 80, Color_White, "‚bŒ¾Œê“ü–å"); DrawFormatString(480 - (GetDrawFormatStringWidth("‚r‚s‚f‚̍ì‚è•û") / 2), 100, Color_White, "‚r‚s‚f‚̍ì‚è•û"); DrawFormatString(480 - (GetDrawFormatStringWidth("ƒvƒƒOƒ‰ƒ€") / 2), 140, Color_White, "ƒvƒƒOƒ‰ƒ€"); DrawFormatString(480 - (GetDrawFormatStringWidth("PetiteTech/petitetech.com") / 2), 160, Color_White, "PetiteTech/petitetech.com"); DrawFormatString(480 - (GetDrawFormatStringWidth("‰æ‘œ‘fÞ") / 2), 200, Color_White, "‰æ‘œ‘fÞ"); DrawFormatString(480 - (GetDrawFormatStringWidth("–³—¿ƒCƒ‰ƒXƒg‘fÞ.com") / 2), 220, Color_White, "–³—¿ƒCƒ‰ƒXƒg‘fÞ.com"); DrawFormatString(480 - (GetDrawFormatStringWidth("pakutaso.com") / 2), 240, Color_White, "pakutaso.com"); DrawFormatString(480 - (GetDrawFormatStringWidth("‰¹ŠyEŒø‰Ê‰¹‘fÞ") / 2), 280, Color_White, "‰¹ŠyEŒø‰Ê‰¹‘fÞ"); DrawFormatString(480 - (GetDrawFormatStringWidth("maoudamashii.jokersounds.com") / 2), 300, Color_White, "maoudamashii.jokersounds.com"); DrawFormatString(480 - (GetDrawFormatStringWidth("Dxlib’˜ìŒ ") / 2), 340, Color_White, "Dxlib’˜ìŒ "); DrawFormatString(480 - (GetDrawFormatStringWidth("DX Library") / 2), 360, Color_White, "DX Library"); DrawFormatString(480 - (GetDrawFormatStringWidth("Copyright(C)2001-2018Takumi Yamada") / 2), 380, Color_White, "Copyright(C)2001-2014Takumi Yamada"); } void my_draw_stage_num(){ DrawFormatString(320 - (GetDrawFormatStringWidth("‚r‚s‚`‚f‚d@%d@‚r‚s‚`‚q‚s",stage_num + 1) / 2), 220, Color_White, "‚r‚s‚`‚f‚d@%d@‚r‚s‚`‚q‚s",stage_num + 1); DrawFormatString(320 - (GetDrawFormatStringWidth("‚o‚k‚`‚x‚d‚q@~@%d",p1.life) / 2), 240, Color_White, "‚o‚k‚`‚x‚d‚q@~@%d",p1.life); } void my_draw_start(){ DrawFormatString(220 - (GetDrawFormatStringWidth("‚r‚s‚`‚f‚d@‚r‚s‚`‚q‚s") / 2),160, Color_White, "‚r‚s‚`‚f‚d@‚r‚s‚`‚q‚s"); } void my_draw_clear(){ DrawFormatString(220 - (GetDrawFormatStringWidth("‚r‚s‚`‚f‚d@‚b‚k‚d‚`‚q") / 2),160, Color_White, "‚r‚s‚`‚f‚d@‚b‚k‚d‚`‚q"); DrawFormatString(220 - (GetDrawFormatStringWidth("‚s‚n‚s‚`‚k@‚r‚b‚n‚q‚d") / 2),180, Color_White, "‚s‚n‚s‚`‚k@‚r‚b‚n‚q‚d"); DrawFormatString(220 - (GetDrawFormatStringWidth("%d",score) / 2),200, Color_White, "%d",score); } void my_draw_gameover(){ if(gameover_flag == 1 && p1.life == 1){ DrawFormatString(220 - (GetDrawFormatStringWidth("‚f‚`‚l‚d@‚n‚u‚d‚q") / 2),220, Color_White, "‚f‚`‚l‚d@‚n‚u‚d‚q"); } } void my_draw_back(){ DrawGraph(0, 0, back_img2, TRUE); DrawGraph(back_img_x, back_img_y, back_img, TRUE); DrawGraph(back_img_x + 440, back_img_y, back_img, TRUE); DrawGraph(back_img_x, back_img_y - 480, back_img, TRUE); DrawGraph(back_img_x + 440, back_img_y - 480, back_img, TRUE); } void my_draw_player(){ if(p1.power > 0){ DrawRotaGraph(p1.draw_x, p1.draw_y,1.0,0.0, player_chip[player_img_count], TRUE); } } void my_draw_player_shot(){ for(int i = 0;i < PLAYER_SHOT_MAX;i++){ if(ps1[i].move_flag == 1 && ps1[i].init_flag == 1){ for(int j = 0;j < ps1[i].max_bullet;j++){ if(ps1[i].flag[j] == 1){ DrawRotaGraph(ps1[i].draw_x[j], ps1[i].draw_y[j],1.0,0.0, player_shot_img, TRUE); } } } } } void my_draw_enemy(){ for (int i = 0; i < DISP_ENEMY_MAX; i++){ if (enemy[i].move_flag == 1 && enemy[i].init_flag == 1){ DrawRotaGraph(enemy[i].draw_x, enemy[i].draw_y,0.7,0.0, enemy_chip[enemy[i].serial_num], TRUE); } } } void my_draw_enemy_shot(){ for(int i = 0;i < ENEMY_SHOT_MAX;i++){ if(enemy_shot[i].move_flag == 1 && enemy_shot[i].init_flag == 1){ for(int j = 0;j < enemy_shot[i].max_bullet;j++){ DrawRotaGraph(enemy_shot[i].draw_x[j], enemy_shot[i].draw_y[j],1.0,0.0, enemy_shot_img, TRUE); } } } } void my_draw_enemy_power(){ SetFontSize(7); for (int i = 0; i < DISP_ENEMY_MAX; i++){ if (enemy[i].move_flag == 1 && enemy[i].init_flag == 1){ int x_point = 0; for (int j = 0; j < enemy[i].power; j++){ DrawFormatString(enemy[i].draw_x + x_point, enemy[i].draw_y - 7, Color_White, "|"); x_point += 1; } } } SetFontSize(16); } void my_draw_boss(){ for (int i = 0; i < DISP_BOSS_MAX; i++){ if (boss[i].move_flag == 1 && boss[i].init_flag == 1){ DrawRotaGraph(boss[i].draw_x, boss[i].draw_y,1.0,0.0, boss_chip[boss[i].serial_num + boss_img_count], TRUE); } } } void my_draw_boss_shot(){ for(int i = 0;i < BOSS_SHOT_MAX;i++){ if(boss_shot[i].move_flag == 1 && boss_shot[i].init_flag == 1){ for(int j = 0;j < boss_shot[i].max_bullet;j++){ DrawRotaGraph(boss_shot[i].draw_x[j], boss_shot[i].draw_y[j],1.0,0.0, boss_shot_img, TRUE); } } } } void my_draw_boss_power(){ SetFontSize(7); for (int i = 0; i < DISP_BOSS_MAX; i++){ if (boss[i].move_flag == 1 && boss[i].init_flag == 1){ int x_point = 0; for (int j = 0; j < boss[i].power; j++){ DrawFormatString(boss[i].draw_x + x_point, boss[i].draw_y - 7, Color_White, "|"); x_point += 1; } } } SetFontSize(16); } void my_draw_exp_effect(){ for (int i = 0;i < EXP_EFFECT_MAX;i++){ if (exp_effect[i].move_flag == 1 && exp_effect[i].init_flag == 1){ DrawRotaGraph(exp_effect[i].draw_x, exp_effect[i].draw_y,1.0,0.0, exp_effect_chip[gamecount % 2], TRUE); } } } void my_draw_item(){ for (int i = 0;i < ITEM_MAX;i++){ if (item[i].move_flag == 1 && item[i].init_flag == 1){ DrawRotaGraph(item[i].draw_x, item[i].draw_y,1.0,0.0, item_img, TRUE); } } } void my_draw_barrier(){ if(barrier1.move_flag == 1 && barrier1.init_flag == 1){ DrawRotaGraph(barrier1.draw_x, barrier1.draw_y,1.0,0.0, barrier_img, TRUE); } } void my_draw_bomb(){ if(bomb1.move_flag == 1 && bomb1.init_flag == 1){ if(bomb1.flag == 1){ DrawBox(0,0,440,480,Color_White,true); } } } void my_draw_score_board(){ DrawGraph(440, 0, back_img3, TRUE); SetFontSize(20); DrawFormatString(540 - (GetDrawFormatStringWidth("‚r‚b‚n‚q‚d") / 2), 20, Color_White, "‚r‚b‚n‚q‚d"); DrawFormatString(540 - (GetDrawFormatStringWidth("%d",score) / 2),40, Color_White, "%d",score); DrawFormatString(540 - (GetDrawFormatStringWidth("‚k‚h‚e‚d") / 2), 80, Color_White, "‚k‚h‚e‚d"); DrawFormatString(540 - (GetDrawFormatStringWidth("1") / 2), 100, Color_White, "%d",p1.life); DrawFormatString(540 - (GetDrawFormatStringWidth("‚a‚n‚l‚a") / 2), 140, Color_White, "‚a‚n‚l‚a"); DrawFormatString(540 - (GetDrawFormatStringWidth("1") / 2), 160, Color_White, "%d",p1.bomb); DrawFormatString(540 - (GetDrawFormatStringWidth("‚a‚`‚q‚q‚h‚d‚q") / 2), 200, Color_White, "‚a‚`‚q‚q‚h‚d‚q"); if(barrier1.move_flag == 1){ DrawFormatString(540 - (GetDrawFormatStringWidth("%d",barrier1.power) / 2), 220, Color_White, "%d",barrier1.power); } else{ DrawFormatString(540 - (GetDrawFormatStringWidth("0") / 2), 220, Color_White, "0"); } SetFontSize(16); } void my_play_se_sound(int se_no){ switch(se_no){ case 0: PlaySoundMem(se1, DX_PLAYTYPE_BACK); break; case 1: PlaySoundMem(se2, DX_PLAYTYPE_BACK); break; case 2: PlaySoundMem(se3, DX_PLAYTYPE_BACK); break; case 3: PlaySoundMem(se4, DX_PLAYTYPE_BACK); break; case 4: PlaySoundMem(se5, DX_PLAYTYPE_BACK); break; case 5: PlaySoundMem(se6, DX_PLAYTYPE_BACK); break; default: break; } } void my_search_bgm_sound(){ int boss_move_flag = 0; switch(game_state){ case 2: my_stop_bgm_sound(); break; case 4: if(gamecount == 1){ my_stop_bgm_sound(); } if(gamecount == 2){ my_play_bgm_sound(0); } break; case 5: my_stop_bgm_sound(); break; case 10: my_stop_bgm_sound(); break; case 15: if(gamecount == 1){ my_stop_bgm_sound(); } if(gamecount == 2){ my_play_bgm_sound(1); } break; case 20: if(gamecount == 1){ my_stop_bgm_sound(); } if(gamecount > 2){ for (int i = 0; i < DISP_BOSS_MAX; i++){ if (boss[i].move_flag == 1 && boss[i].init_flag == 1){ boss_move_flag = 1; break; } } if(boss_move_flag == 1){ if(!CheckSoundMem(bgm4)){ my_stop_bgm_sound(); my_play_bgm_sound(3); } } else{ if(!CheckSoundMem(bgm3)){ my_stop_bgm_sound(); my_play_bgm_sound(2); } } } break; case 25: if(gamecount == 1){ my_stop_bgm_sound(); } if(gamecount == 2){ my_play_bgm_sound(4); } break; case 30: if(gamecount == 1){ my_stop_bgm_sound(); } if(gamecount == 2){ my_play_bgm_sound(5); } break; default: break; } } void my_play_bgm_sound(int bgm_no){ switch(bgm_no){ case 0: PlaySoundMem(bgm1, DX_PLAYTYPE_LOOP); break; case 1: PlaySoundMem(bgm2, DX_PLAYTYPE_LOOP); break; case 2: PlaySoundMem(bgm3, DX_PLAYTYPE_LOOP); break; case 3: PlaySoundMem(bgm4, DX_PLAYTYPE_LOOP); break; case 4: PlaySoundMem(bgm5, DX_PLAYTYPE_LOOP); break; case 5: PlaySoundMem(bgm6, DX_PLAYTYPE_LOOP); break; default: break; } } void my_stop_bgm_sound(){ StopSoundMem(bgm1); StopSoundMem(bgm2); StopSoundMem(bgm3); StopSoundMem(bgm4); StopSoundMem(bgm5); StopSoundMem(bgm6); } void my_timer(){ gamecount++; } int my_get_key(){ char keys[256]; GetHitKeyStateAll(keys); for (int i = 0; i < 256; i++){ if (keys[i] != 0){ key[i]++; } else{ key[i] = 0; } } return 0; }

/*ƒy[ƒW‚̐擪‚Ö*/

/*–ÚŽŸ‚Ö–ß‚é*/

/*HOME*/

/*Copyright 2016 K.N/petitetech.com*/

/*L*/