⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 一个出人意料的仿玛丽游戏
💻 CPP
📖 第 1 页 / 共 5 页
字号:
str("俲愭攜",240-3*20/2,xx[25]/100);
str("摦夋僉儍僾僠儍丒曇廤丒僄儞僐乕僪",240-16*20/2,xx[26]/100);
str("willowlet ",240-5*20/2,xx[27]/100);
str("僾儘僌儔儉丒昤夋丒僱僞丒摦夋曇廤",240-16*20/2,xx[28]/100);
str("偪偔",240-2*20/2,xx[29]/100);

str("僾儗僀偟偰偄偨偩偒丂偁傝偑偲偆偛偞偄傑偟偨乣",240-22*20/2,xx[30]/100);
}



if (main==10){

setc0();
fillrect(0,0,fxmax,fymax);

SetFontSize(16) ;
SetFontThickness(4) ;

drawimage(grap[0][0],190,190);
DrawFormatString(230,200,GetColor(255,255,255)," 亊 %d",nokori);


}//if (main==10){


//僞僀僩儖
if (main==100){

setcolor(160,180,250);
fillrect(0,0,fxmax,fymax);

drawimage(mgrap[30],240-380/2,60);

drawimage(grap[0][4],12*30,10*29-12);
drawimage(grap[1][4],6*30,12*29-12);

//僾儗僀儎乕
drawimage(grap[0][0],2*30,12*29-12-6);
for (t=0;t<=16;t++){
drawimage(grap[5][1],29*t,13*29-12);
drawimage(grap[6][1],29*t,14*29-12);
}


setcolor(0,0,0);
str("Enter僉乕傪墴偣!!",240-8*20/2,250);

}//if (main==100){



//DrawFormatString(230,200,GetColor(255,255,255)," 亊 %d,%d,%d",sta,stb,stc);

ScreenFlip();

}//rpaint()







//儊僀儞僾儘僌儔儉
void Mainprogram(){

stime=long(GetNowCount());


if (ending==1)main=2;


//僉乕
key = GetJoypadInputState(DX_INPUT_KEY_PAD1);


if (main==1 && tmsgtype==0){


if (zxon==0){
zxon=1;
mainmsgtype=0;

stagecolor=1;
ma=5600;mb=32000;mmuki=1;mhp=1;
mc=0;md=0;
mnobia=3000;mnobib=3600;

mtype=0;
//if (stc==1)end();

fx=0;fy=0;
fzx=0;
stageonoff=0;




//僠乕僞乕儅儞丂擖傟
bgmchange(oto[100]);

stagecls();

stage();


//儔儞僟儉偵偝偣傞
if (over==1){
//for (t=0;t<;t++){na[t]=rand(300000);nb[t]=rand(3000);}
for (t=0;t<tmax;t++){if (rand(3)<=1){ta[t]=(rand(500)-1)*29*100;tb[t]=rand(14)*100*29-1200;ttype[t]=rand(142);if (ttype[t]>=9 && ttype[t]<=99){ttype[t]=rand(8);}txtype[t]=rand(4);}}
for (t=0;t<bmax;t++){if (rand(2)<=1){ba[t]=(rand(500)-1)*29*100;bb[t]=rand(15)*100*29-1200-3000;if (rand(6)==0){btype[t]=rand(9);}}}

srco=0;
t=srco;sra[t]=ma+fx;srb[t]=(13*29-12)*100;src[t]=30*100;srtype[t]=0;sracttype[t]=0;sre[t]=0;srsp[t]=0;srco++;

if (rand(4)==0)stagecolor=rand(4);
//if (rand(6)==0)bgmchange(oto[rand(6)+100]);
}



StopSoundMem(oto[0]);


//儊僀儞BGM
PlaySoundMem(oto[0],DX_PLAYTYPE_LOOP) ;
//PlayMusic("BGM/titerman.mp3",DX_PLAYTYPE_LOOP) ;


}//zxon

//xx[1]=rand(100);







//僾儗僀儎乕偺堏摦
xx[0]=0;actaon[2]=0;actaon[3]=0;
if (mkeytm<=0){
if (( key & PAD_INPUT_LEFT) && keytm<=0){actaon[0]=-1;mmuki=0;actaon[4]=-1;}	
if (( key & PAD_INPUT_RIGHT) && keytm<=0){actaon[0]=1;mmuki=1;actaon[4]=1;}
if (key & PAD_INPUT_DOWN){actaon[3]=1;}
}

//if (CheckHitKey(KEY_INPUT_F1)==1){end();}
if (CheckHitKey(KEY_INPUT_F1)==1){main=100;}
//if (CheckHitKey(KEY_INPUT_Q)==1){mkeytm=0;}
if (CheckHitKey(KEY_INPUT_O)==1){if (mhp>=1)mhp=0;if (stc>=5){stc=0;stagepoint=0;}}


if (mkeytm<=0){
if (key & PAD_INPUT_UP || CheckHitKey(KEY_INPUT_Z)==1){//end();
if (actaon[1]==10){actaon[1]=1;xx[0]=1;}
actaon[2]=1;
}}

if (key & PAD_INPUT_UP || CheckHitKey(KEY_INPUT_Z)==1){
if (mjumptm==8 && md>=-900){
md=-1300;
//僟僢僔儏拞
xx[22]=200;if (mc>=xx[22] || mc<=-xx[22]){md=-1400;}
xx[22]=600;if (mc>=xx[22] || mc<=-xx[22]){md=-1500;}
}
// && xx[0]==0 && md<=-10

//if (mjumptm==7 && md>=-900){}
if (xx[0]==0)actaon[1]=10;
}




//if (( key & PAD_INPUT_UP) && keytm<=0){actaon[0]=-1;mmuki=0;}	

//xx[0]=200;
//if (actaon[0]==-1){ma-=xx[0];}
//if (actaon[0]==1){ma+=xx[0];}


//壛懍偵傛傞堏摦
xx[0]=40;xx[1]=700;xx[8]=500;xx[9]=700;
xx[12]=1;xx[13]=2;

//偡傋傝曗惓
if (mrzimen==1){xx[0]=20;xx[12]=9;xx[13]=10;}


//if (mzimen==0){xx[0]-=15;}
if (actaon[0]==-1){
if (!(mzimen==0 && mc<-xx[8])){
if (mc>=-xx[9]){mc-=xx[0];if (mc<-xx[9]){mc=-xx[9]-1;}}
if (mc<-xx[9] && atktm<=0)mc-=xx[0]/10;
}
if (mrzimen!=1){
if (mc>100 && mzimen==0){mc-=xx[0]*2/3;}
if (mc>100 && mzimen==1){mc-=xx[0];if (mzimen==1){mc-=xx[0]*1/2;}}actaon[0]=3;
mkasok+=1;
}}

if (actaon[0]==1){
if (!(mzimen==0 && mc>xx[8])){
if (mc<=xx[9]){mc+=xx[0];if (mc>xx[9]){mc=xx[9]+1;}}
if (mc>xx[9] && atktm<=0)mc+=xx[0]/10;
}
if (mrzimen!=1){
if (mc<-100 && mzimen==0){mc+=xx[0]*2/3;}
if (mc<-100 && mzimen==1){mc+=xx[0];if (mzimen==1){mc+=xx[0]*1/2;}}actaon[0]=3;mkasok+=1;
}}
if (actaon[0]==0 && mkasok>0){mkasok-=2;}if (mkasok>8){mkasok=8;}

//偡傋傝曗惓弶婜壔
if (mzimen!=1)mrzimen=0;


//僕儍儞僾
if (mjumptm>=0)mjumptm--;
if (actaon[1]==1 && mzimen==1){
mb-=400;md=-1200;mjumptm=10;

//PlaySound( "jump.mp3" , DX_PLAYTYPE_NORMAL ) ;

//PlayMusic( "SE/jump.mp3" , DX_PLAYTYPE_NORMAL ) ;

//PlaySoundMem( oto[1], DX_PLAYTYPE_NORMAL ) ;

//PlaySoundMem( oto[1], DX_PLAYTYPE_BACK) ;
ot(oto[1]);

/*
md=-1040;
xx[1]=600;if (mc>xx[1] || mc<=-xx[1]){md=-1400;}
xx[1]=7;xx[2]=400;
if (mkasok>xx[1] && (mc>xx[2] || mc<=-xx[2])){
md=-1600;
if (mc>=800 || mc<=-800){md=-1800;}
}
*/

mzimen=0;

}
if (actaon[1]<=9)actaon[1]=0;

//if (actaon[1]==1){my+=xx[1];actaon[1]=0;}

//}//棨抧


if (mmutekitm>=-1)mmutekitm--;


//HP偑側偔側偭偨偲偒
if (mhp<=0 && mhp>=-9){
mkeytm=12;mhp=-20;mtype=200;mtm=0;ot(oto[12]);StopSoundMem(oto[0]);StopSoundMem(oto[11]);StopSoundMem(oto[16]);
}//mhp
//if (mhp<=-10){
if (mtype==200){
if (mtm<=11){mc=0;md=0;}
if (mtm==12){md=-1200;}
if (mtm>=12){mc=0;}
if (mtm>=100 || fast==1){zxon=0;main=10;mtm=0;mkeytm=0;nokori--;if (fast==1)mtype=0;}//mtm>=100
}//mtype==200




//壒晞偵傛傞儚乕僾
if (mtype==2){
mtm++;

mkeytm=2;
md=-1500;
if (mb<=-6000){blackx=1;blacktm=20;stc+=5;stagerr=0;StopSoundMem(oto[0]);mtm=0;mtype=0;mkeytm=-1;}
}//2

//僕儍儞僾戜傾僂僩
if (mtype==3){
md=-2400;
if (mb<=-6000){mb=-80000000;mhp=0;}
}


//mtype偵傛傞摿庩揑側堏摦
if (mtype>=100){mtm++;

//晛捠偺搚娗
if (mtype==100){
if (mxtype==0){
mc=0;md=0;t=28;
if (mtm<=16){mb+=240;mzz=100;}
if (mtm==17){mb=-80000000;}
if (mtm==23){sa[t]-=100;}
if (mtm>=44 && mtm<=60){
if (mtm%2==0)sa[t]+=200;
if (mtm%2==1)sa[t]-=200;
}
if (mtm>=61 && mtm<=77){
if (mtm%2==0)sa[t]+=400;
if (mtm%2==1)sa[t]-=400;
}
if (mtm>=78 && mtm<=78+16){
if (mtm%2==0)sa[t]+=600;
if (mtm%2==1)sa[t]-=600;
}
if (mtm>=110){sb[t]-=mzz;mzz+=80;if (mzz>1600)mzz=1600;}
if (mtm==160){mtype=0;mhp--;}

}

//傆偭偲偽偟
else if (mxtype==10){
mc=0;md=0;
if (mtm<=16){ma+=240;}//mzz=100;}
if (mtm==16)mb-=1100;
if (mtm==20)ot(oto[10]);

if (mtm>=24){ma-=2000;mmuki=0;}
if (mtm>=48){mtype=0;mhp--;}

}else{
mc=0;md=0;
if (mtm<=16 && mxtype!=3){mb+=240;}//mzz=100;}
if (mtm<=16 && mxtype==3){ma+=240;}
if (mtm==19 && mxtype==2){mhp=0;mtype=2000;mtm=0;mmsgtm=30;mmsgtype=51;}
if (mtm==19 && mxtype==5){mhp=0;mtype=2000;mtm=0;mmsgtm=30;mmsgtype=52;}
if (mtm==20){
if(mxtype == 6){
  stc += 10;
}else{
  stc++;
}
mb=-80000000;
mxtype=0;
blackx=1;
blacktm=20;
stagerr=0;StopSoundMem(oto[0]);
}}
}//00


if (mtype==300){
mkeytm=3;
if (mtm<=1){mc=0;md=0;}
if (mtm>=2 && mtm<=42){md=600;mmuki=1;}
if (mtm>43 && mtm<=108){mc=300;}
if (mtm==110){mb=-80000000;mc=0;}
if (mtm==250){
  stb++;stc=0;zxon=0;tyuukan=0;main=10;maintm=0;
}
}//mtype==300

if (mtype==301 || mtype==302){
mkeytm=3;

if (mtm<=1){mc=0;md=0;}

if (mtm>=2 && (mtype==301 && mtm<=102 || mtype==302 && mtm<=60)){
xx[5]=500;
ma-=xx[5];fx+=xx[5];fzx+=xx[5];
}

if ((mtype==301 || mtype==302) && mtm>=2 && mtm<=100){
mc=250;mmuki=1;
}

if (mtm==200){
ot(oto[17]);
if(mtype==301){
  na[nco]=117*29*100-1100;nb[nco]=4*29*100;ntype[nco]=101;nco++;if (nco>=nmax)nco=0;
  na[nco]=115*29*100-1100;nb[nco]=6*29*100;ntype[nco]=102;nco++;if (nco>=nmax)nco=0;
}else{
  na[nco]=157*29*100-1100;nb[nco]=4*29*100;ntype[nco]=101;nco++;if (nco>=nmax)nco=0;
  na[nco]=155*29*100-1100;nb[nco]=6*29*100;ntype[nco]=102;nco++;if (nco>=nmax)nco=0;
}
}
//僗僞僢僼儘乕儖傊

if (mtm==440){
  if(mtype==301){
    ending = 1;
  }else{
    sta++;stb=0;stc=0;
  }
}


/*
if (mtm<=1){mc=0;md=0;}
if (mtm>=2 && mtm<=42){md=600;mmuki=1;}
if (mtm>43 && mtm<=108){mc=300;}
if (mtm==110){mb=-80000000;mc=0;}
if (mtm==250)end();
*/
}//mtype==301

}//mtype>=100




//堏摦
if (mkeytm>=1){mkeytm--;}//mc=0;}
ma+=mc;mb+=md;
if (mc<0)mactp+=(-mc);
if (mc>=0)mactp+=mc;

if (mtype<=9 || mtype==200 || mtype==300 || mtype==301 || mtype==302)md+=100;


//憱傞嵺偺嵟戝抣
if (mtype==0){
xx[0]=800;xx[1]=1600;
if (mc>xx[0] && mc<xx[0]+200){mc=xx[0];}
if (mc>xx[0]+200){mc-=200;}
if (mc<-xx[0] && mc>-xx[0]-200){mc=-xx[0];}
if (mc<-xx[0]-200){mc+=200;}
if (md>xx[1]){md=xx[1];}
}

//僾儗僀儎乕
//抧柺偺杸嶤
if (mzimen==1 && actaon[0]!=3){
if ((mtype<=9) || mtype==300 || mtype==301 || mtype==302){
if (mrzimen==0){
xx[2]=30;xx[1]=60;xx[3]=30;
if (mc>=-xx[3] && mc<=xx[3]){mc=0;}
if (mc>=xx[2]){mc-=xx[1];}
if (mc<=-xx[2]){mc+=xx[1];}
}
if (mrzimen==1){
xx[2]=5;xx[1]=10;xx[3]=5;
if (mc>=-xx[3] && mc<=xx[3]){mc=0;}
if (mc>=xx[2]){mc-=xx[1];}
if (mc<=-xx[2]){mc+=xx[1];}
}
}}


//抧柺敾掕弶婜壔
mzimen=0;

//応奜
if (mtype<=9 && mhp>=1){
if (ma<100){ma=100;mc=0;}
if (ma+mnobia>fxmax){ma=fxmax-mnobia;mc=0;}
}
//if (mb>=42000){mb=42000;mzimen=1;}
if (mb>=38000 && mhp>=0 && stagecolor==4){mhp=-2;mmsgtm=30;mmsgtype=55;}
if (mb>=52000 && mhp>=0){mhp=-2;}






//僽儘僢僋
//1-傟傫偑丄僐僀儞丄柍偟丄搚戜丄7-塀偟

xx[15]=0;
for (t=0;t<tmax;t++){
xx[0]=200;xx[1]=3000;xx[2]=1000;xx[3]=3000;//xx[2]=1000
xx[8]=ta[t]-fx;xx[9]=tb[t]-fy;//xx[15]=0;
if (ta[t]-fx+xx[1]>=-10-xx[3] && ta[t]-fx<=fxmax+12000+xx[3]){
if (mtype!=200 && mtype!=1 && mtype!=2){
if (ttype[t]<1000 && ttype[t]!=800 && ttype[t]!=140 && ttype[t]!=141){// && ttype[t]!=5){

//if (!(mztm>=1 && mztype==1 && actaon[3]==1)){
if (!(mztype==1)){
xx[16]=0;xx[17]=0;

//忋
if (ttype[t]!=7 && ttype[t]!=110 && !(ttype[t]==114)){
if (ma+mnobia>xx[8]+xx[0]*2+100 && ma<xx[8]+xx[1]-xx[0]*2-100 && mb+mnobib>xx[9] && mb+mnobib<xx[9]+xx[1] && md>=-100){
if (ttype[t]!=115 && ttype[t]!=400 && ttype[t]!=117 && ttype[t]!=118 && ttype[t]!=120){
mb=xx[9]-mnobib+100;md=0;mzimen=1;xx[16]=1;
}
else if (ttype[t]==115){
ot(oto[3]);
eyobi(ta[t]+1200,tb[t]+1200,300,-1000,0,160,1000,1000,1,120);
eyobi(ta[t]+1200,tb[t]+1200,-300,-1000,0,160,1000,1000,1,120);
eyobi(ta[t]+1200,tb[t]+1200,240,-1400,0,160,1000,1000,1,120);
eyobi(ta[t]+1200,tb[t]+1200,-240,-1400,0,160,1000,1000,1,120);
brockbreak(t);
}
//P僗僀僢僠
else if (ttype[t]==400){
md=0;ta[t]=-8000000;ot(oto[13]);
for (tt=0;tt<tmax;tt++){if (ttype[tt]!=7){ttype[tt]=800;}}
StopSoundMem(oto[0]);
}

//壒晞+
else if (ttype[t]==117){
ot(oto[14]);
md=-1500;mtype=2;mtm=0;
if (txtype[t]>=2 && mtype==2){mtype=0;md=-1600;txtype[t]=3;}
if (txtype[t]==0)txtype[t]=1;
}

//僕儍儞僾戜
else if (ttype[t]==120){
//txtype[t]=0;
md=-2400;mtype=3;mtm=0;
}

}}
}//!


//sstr=""+mjumptm;
//僽儘僢僋敾掕偺擖傟懼偊
if (!(mztm>=1 && mztype==1)){
xx[21]=0;xx[22]=1;//xx[12]=0;
if (mzimen==1 || mjumptm>=10){xx[21]=3;xx[22]=0;}
for (t3=0;t3<=1;t3++){

//壓
if (t3==xx[21] && mtype!=100 && ttype[t]!=117){// && xx[12]==0){
if (ma+mnobia>xx[8]+xx[0]*2+800 && ma<xx[8]+xx[1]-xx[0]*2-800 && mb>xx[9]-xx[0]*2 && mb<xx[9]+xx[1]-xx[0]*2 && md<=0){xx[16]=1;xx[17]=1;
mb=xx[9]+xx[1]+xx[0];if (md<0){md=-md*2/3;}//}
//夡傟傞
if (ttype[t]==1 && mzimen==0){
ot(oto[3]);
eyobi(ta[t]+1200,tb[t]+1200,300,-1000,0,160,1000,1000,1,120);
eyobi(ta[t]+1200,tb[t]+1200,-300,-1000,0,160,1000,1000,1,120);
eyobi(ta[t]+1200,tb[t]+1200,240,-1400,0,160,1000,1000,1,120);
eyobi(ta[t]+1200,tb[t]+1200,-240,-1400,0,160,1000,1000,1,120);
brockbreak(t);
}
//僐僀儞
if (ttype[t]==2 && mzimen==0){
ot(oto[4]);
eyobi(ta[t]+10,tb[t],0,-800,0,40,3000,3000,0,16);
ttype[t]=3;
}
//塀偟
if (ttype[t]==7){
ot(oto[4]);
eyobi(ta[t]+10,tb[t],0,-800,0,40,3000,3000,0,16);
mb=xx[9]+xx[1]+xx[0];ttype[t]=3;if (md<0){md=-md*2/3;}
}
// 僩僎
if (ttype[t]==10){
  mmsgtm=30;
  mmsgtype=3;
  mhp--;
}
}}


//嵍塃

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -