まずは変身後の自機、ショット、変身エフェクトの画像、効果音を用意します。
効果音は弾が変化するときのもので代用します。
第三の服も適当に実装しています。
第三の服の仕様について
攻撃ボタンを押さないとき、常に自機から一番近くにいる敵にレーザーを浴びせるというようにする。
敵を倒した後はその敵がいた位置に近い敵にレーザーを向ける。
GV.hの以下を変更
load.cppのload()に以下を追加
LoadDivGraph( "../dat/img/char/1.png" , 12 , 4 , 3 , 73 , 73 , img_ch[1] ) ;
LoadDivGraph( "../dat/img/char/2.png" , 12 , 4 , 3 , 73 , 73 , img_ch[2] ) ;
img_cshot[2]=LoadGraph("../dat/img/char/bl_20.png");
img_cshot[3]=LoadGraph("../dat/img/char/bl_21.png");
img_cshot[4]=LoadGraph("../dat/img/char/bl_30.png");
graph.cppのgraph_ch()の以下を変更 ch.cppに変身するための処理を追加します。
extern int search_effect();
//変身時のエフェクト
void enter_change_effect(){
int i,k;
for(i=0;i30){
effect[i].brt=255-8*(effect[i].cnt-30);
}
if(effect[i].cnt>60){
effect[i].flag=0;
}
effect[i].ang+=PI2/60;
effect[i].cnt++;
break;
変身後のショットについて書きます。
ここでは魅惑のドレスの通常ショットについてかき、
レーザーは別に扱います。
cshot.cppに以下を追加
//魅惑のドレス通常ショット登録
void ch2_shot_pattern(){
enter_cshot_bullet(img_cshot[2],0,(ch.power=100){
enter_cshot_bullet(img_cshot[2],0,20+ch.power/100,ch.x+10,ch.y+10,-PI/2,20);
enter_cshot_bullet(img_cshot[2],0,20+ch.power/100,ch.x-10,ch.y+10,-PI/2,20);
}
if(ch.power>=200){
enter_cshot_bullet(img_cshot[2],0,20+ch.power/100,ch.x+20,ch.y+20,-PI/2,20);
enter_cshot_bullet(img_cshot[2],0,20+ch.power/100,ch.x-20,ch.y+20,-PI/2,20);
}
}
//ショット登録部
void enter_shot(){
//ショットボタンが押されていたら
if(CheckStatePad(configpad.shot)>0){
ch.shot_cnt++;
if(ch.shot_cnt%3==0){//3カウントに1回
if(CheckStatePad(configpad.slow)>0){//低速移動中なら
if(ch.shot_mode==0){
ch1_shot_pattern();
}
}
else{
if(ch.shot_mode==0){
ch0_shot_pattern();
}
else if(ch.shot_mode==1){
ch2_shot_pattern();
}
}
}
}
else
ch.shot_cnt=0;
}
ここからはレーザーについてです。
以下の構造体を用意します。
struct.hに追加。
//キャラクターのレーザー
typedef struct{
int flag;//フラグ
//第三の服のターゲットの指定に使う numは-1ならボス 0以上はザコ
double x,y;
int num;
}clazer_t;
cshot.cppに以下を追加
//レーザー登録部
void enter_clazer(){
if(ch.shot_mode==1 && CheckStatePad(configpad.shot)>0 && CheckStatePad(configpad.slow)>0){
clazer.flag=1;
return;
}
if(ch.shot_mode==2 && CheckStatePad(configpad.shot)==0){
clazer.flag=1;
return;
}
clazer.flag=0;
}
//第三の服の攻撃のターゲット選択
void clazer_target(){
int i,d, num=-1, min=-1;
double x,y;
if(ch.shot_mode!=2 || clazer.flag==0){
clazer.x=ch.x;
clazer.y=ch.y;
return;
}
if(boss.flag==0){//ボスが居ない時
for(i=0;i0){
if(enemy[s].y=-(6+enemy_range[enemy[s].knd]) ){
hit_enemy(s,40);
}
}
}
//ボスが出現していて、描画しないフラグがオフで、ショット中なら
if(boss.flag==1 && boss.graph_flag==0 && boss.state==2){
if(boss.y=-(6+BRANGE) ){
hit_boss(40);
}
}
break;
case 2:
if(clazer.num>-1){
hit_enemy(clazer.num,8*(1+ch.power/100));
}
if(clazer.num==-1){
hit_boss(8*(1+ch.power/100) );
}
break;
}
}
//自機レーザー描画
void graph_clazer(){
double angle;
if(clazer.flag==1){
switch(ch.shot_mode){
case 1:
DrawModiGraphFdF(ch.x-6,-50,ch.x+6,-50,ch.x+6,ch.y,ch.x-6,ch.y,img_cshot[3],TRUE);
break;
case 2:
SetDrawBlendMode(DX_BLENDMODE_ALPHA,100);
if(clazer.num>=0){
angle=atan2(enemy[clazer.num].y-ch.y,enemy[clazer.num].x-ch.x);
DrawModiGraphFdF(enemy[clazer.num].x+6*sin(angle),enemy[clazer.num].y-6*cos(angle),enemy[clazer.num].x-6*sin(angle),enemy[clazer.num].y+6*cos(angle),
ch.x-6*sin(angle),ch.y+6*cos(angle),ch.x+6*sin(angle),ch.y-6*cos(angle),img_cshot[4],TRUE);
for(int i=0;i<3;i++){
if(option_bb[i].flag==1){
angle=atan2(enemy[clazer.num].y-option_bb[i].y,enemy[clazer.num].x-option_bb[i].x);
DrawModiGraphFdF(enemy[clazer.num].x+6*sin(angle),enemy[clazer.num].y-6*cos(angle),enemy[clazer.num].x-6*sin(angle),enemy[clazer.num].y+6*cos(angle),
option_bb[i].x-6*sin(angle),option_bb[i].y+6*cos(angle),option_bb[i].x+6*sin(angle),option_bb[i].y-6*cos(angle),img_cshot[4],TRUE);
}
}
}
else if(clazer.num==-1){
angle=atan2(boss.y-ch.y,boss.x-ch.x);
DrawModiGraphFdF(boss.x+6*sin(angle),boss.y-6*cos(angle),boss.x-6*sin(angle),boss.y+6*cos(angle),
ch.x-6*sin(angle),ch.y+6*cos(angle),ch.x+6*sin(angle),ch.y-6*cos(angle),img_cshot[4],TRUE);
for(int i=0;i<3;i++){
if(option_bb[i].flag==1){
angle=atan2(boss.y-option_bb[i].y,boss.x-option_bb[i].x);
DrawModiGraphFdF(boss.x+6*sin(angle),boss.y-6*cos(angle),boss.x-6*sin(angle),boss.y+6*cos(angle),
option_bb[i].x-6*sin(angle),option_bb[i].y+6*cos(angle),option_bb[i].x+6*sin(angle),option_bb[i].y-6*cos(angle),img_cshot[4],TRUE);
}
}
}
SetDrawBlendMode(DX_BLENDMODE_NOBLEND,0);
break;
}
}
}
あと必要なのはなんだろう。