📄 subject_41683.htm
字号:
<p>
序号:41683 发表者:wuquan 发表日期:2003-05-28 18:37:50
<br>主题:HELP!!!我作业TC3开发打飞机小游戏 新手上路 紧急!
<br>内容:#include<bios.h><BR>#include<graphics.h><BR>#include<bios.h><BR>class plane<BR>{public:<BR>int x,y;<BR>plane(){x=1;y=1;}<BR><BR>void drawplane();<BR>void move1();<BR>void move2();<BR>void move3();<BR>void life();<BR>}plane[2];<BR>void plane::drawplane()<BR>{<BR>bar(12+x*8,2+y*8,28+x*8,10+y*8);<BR>bar(16+x*8,10+y*8,24+x*8,34+y*8);<BR>bar(8+x*8,18+y*8,32+x*8,26+y*8);<BR>setfillstyle(1,1);<BR>}<BR>void plane::move1()<BR>{<BR><BR> while(plane[1].x>=5)<BR> {plane[1].x--;<BR> cleardevice();<BR> plane[1].drawplane();<BR> }<BR> if(plane[1].x==4)<BR> while(plane[1].x<=39)<BR> {plane[1].x++;<BR> cleardevice();<BR> plane[1].drawplane();<BR> }<BR>}<BR>void plane::move2()<BR> {<BR><BR> while(plane[2].x>=78)<BR> {plane[i].x--;<BR> cleardevice();<BR> plane[i].drawplane();<BR> }<BR> else<BR> if(plane[i].x=4)<BR> while(plane[i].x<=39)<BR> {plane[i].x++;<BR> cleardevice();<BR> plane[i].drawplane();<BR> }<BR>}<BR><BR><BR> void plane::move3()<BR> {for(int i=0;i<2;i++)<BR> { while(plane[i].y<=37)<BR> {plane[i].y++;<BR> cleardevice();<BR> plane[i].drawplane();<BR> }<BR> if(plane[i].y=38)<BR> {cleardevice();<BR> cout<<"GAME OVER!"<<endl;}<BR> }<BR> }<BR> void plane::life()<BR> { for(int i=0;i<2;i++)<BR> if (fire1.x>=plane[i].x*8+16&&<BR> fire1.x<=plane[i].x*8+24&&<BR> fire1.x>=plane[i].y*8+10&&<BR> fire1.x<=plane[i].y*8+34&&<BR> fire1.x>=plane[i].x*8+8&&<BR> fire1.x<=plane[i].x*8+32&&<BR> fire1.y>=plane[i].y*8+18&&<BR> fire1.y<=plane[i].y*8+26)<BR> //setcolor to plane[i] and fire1<BR> }<BR><BR><BR><BR> class gun<BR> {public:<BR> int x,y;<BR> gun(){x=256;y=475;}<BR> void drawgun();<BR> void move();<BR> void life();<BR> int Getx();<BR> int Gety();<BR> }gun1;<BR> void gun::drawgun()<BR> {<BR> bar(a,b,c,d);//value put in later;<BR> }<BR><BR> void gun::move()<BR> {//code put in later;<BR> switch(op)<BR> {case left:(GUN.Getx)--;<BR> case right:(GUN.Getx)++;<BR> default:;<BR> }<BR> class fire<BR> {public:<BR> int x,y,r;<BR> fire(){x= ;y= ;r= ;}//value put in later;<BR> void drawfire();<BR> void move(fire &);<BR> void life();<BR> }fire1;<BR> void fire::drawfire()<BR> {circle(x,y,r);}<BR> void move(fire &FIRE)<BR> { int k=bioskey(0);<BR> switch(k)<BR> {case Left:if(gun1.x>=a)//a :move to furthest pointer<BR> gun1.x--;<BR> cleardevice();gun1.drawgun();<BR> case Right:if(gun1.x<=b)<BR> gun1.x++;<BR> cleardevice();gun1.drawgun();<BR> case Pageup:fire1.y--;cleardevice();//LIFE?<BR> }<BR> }<BR><BR> void life()<BR> {}//put in code later<BR> void main()<BR> {
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:试一试 回复日期:2003-06-02 19:56:10
<br>内容:有你这样请教的吗?注解没有也就罢了。竟然连碰到什么问题也不说。就放一些甲骷文在这里,让人猜!(不是我想要说你)
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -