JS双人小游戏源码Word下载.docx
- 文档编号:15309637
- 上传时间:2022-10-29
- 格式:DOCX
- 页数:15
- 大小:18.27KB
JS双人小游戏源码Word下载.docx
《JS双人小游戏源码Word下载.docx》由会员分享,可在线阅读,更多相关《JS双人小游戏源码Word下载.docx(15页珍藏版)》请在冰豆网上搜索。
varballcol=0;
--[Step1]:
这里可以更改弹球的次数-->
varballnum=10;
varballsta=newArray(40);
varplanecol=newArray(5);
planecol[0]="
#FFFF00"
;
planecol[1]="
#FFCF00"
planecol[2]="
#FF7F00"
planecol[3]="
#FF3F00"
planecol[4]="
#FF0000"
planecol[5]="
#000000"
functionPopUpBall(){
bgIE.style.posTop=116;
bgIE.style.posLeft=116;
ball.style.posTop=290;
ball.style.posLeft=209;
ballracket.style.posTop=300;
ballracket.style.posLeft=195;
ballbutton.style.posTop=-1000;
ballbutton.style.posLeft=-1000;
endgame.style.posTop=-1000;
endgame.style.posLeft=-1000;
for(ib=0;
ib<
5;
ib++){
for(ia=0;
ia<
8;
ia++){ballsta[ib*8+ia]=ib;
}}
ballbutton.style.posTop=300;
ballbutton.style.posLeft=280;
}
functionBallMain(){
clearTimeout(index);
balltime=balltime+1;
with(Math){tmpballtime=floor(balltime/10)};
ballX=ballX+ballDX;
ballY=ballY+ballDY;
ErrorCheck();
PlaneCheck();
ball.style.posTop=ballY;
ball.style.posLeft=ballX;
if(gameFLG==01){index=setTimeout("
BallMain()"
0);
}
functionErrorCheck(){
if(ballX<
16){ballX=32-ballX;
ballDX=-ballDX;
if(ballX>
401){ballX=802-ballX;
if(ballY<
16){ballY=32-ballY;
ballDY=-ballDY;
if(ballY>
=272){
if(missFLG==0){tmpX=(ballDX/ballDY)*(272-ballY)+ballX;
if(tmpX>
=tmpRL-12){
if(tmpX<
=tmpRL+42){
ballY=272;
ballX=tmpX;
ballRD=tmpX-tmpRL;
with(Math){ballDX=8*abs(ballDX)/ballDX;
if(ballRD<
-4){ballDX=-15;
if(ballRD>
36){ballDX=15;
=14){if(ballRD<
=16){ballDX=-2;
=17){if(ballRD<
=20){ballDX=2;
=0){if(ballRD<
=4){ballDX=-4;
=28){if(ballRD<
=32){ballDX=4;
=-4){if(ballRD<
=-1){ballDX=-11;
=33){if(ballRD<
=36){ballDX=11;
}}}}
if(ballDY>
0){missFLG=1;
}}
else{if(ballY>
290){missFLG=0;
ballnum=ballnum-1;
EndBall();
}}}
functionPlaneCheck(){
tmpY=ballY+4;
tmpX=ballX+4;
if(tmpY>
=48){
if(tmpY<
=147){
=29){
=396){
with(Math){
ia=floor((tmpX-29)/46);
ib=floor((tmpY-48)/20);
ic=ib*8+ia;
if(ballsta[ic]<
=4){
tmpbc=ballsta[ic]+1;
ballsta[ic]=tmpbc;
chc(ic+1,tmpbc);
if(tmpbc==5){ballcol=ballcol+1;
if(ballcol>
=40){EndBall();
if(ballDX>
0){
iy=(ballDY/ballDX)*(29+46*ia-tmpX)+tmpY;
if(iy>
48+20*ib+18){
tmpY1=48+20*ib+18;
tmpX1=(ballDX/ballDY)*(48+20*ib+18-tmpY)+tmpX;
ballX=tmpX1-4;
ballY=tmpY1-4;
}
else{
if(iy<
44+20*ib){
tmpY1=48+20*ib;
tmpX1=(ballDX/ballDY)*(48+20*ib-tmpY)+tmpX;
else{
tmpX1=29+46*ia;
tmpY1=(ballDY/ballDX)*(29+46*ia-tmpX)+tmpY;
}}}
iy=(ballDY/ballDX)*(29+46*ia+44-tmpX)+tmpY;
else{
tmpX1=29+46*ia+44;
tmpY1=(ballDY/ballDX)*(29+46*ia+44-tmpX)+tmpY;
}}}}}}}}
functioninitAll(){
=40){
ballcol=0;
balltime=0;
ballnum=3;
with(Math){tmpballtime=floor(balltime/10);
ib++){
ia++){
chc(ib*8+ia+1,ib);
ballsta[ib*8+ia]=ib;
gameFLG=1;
ballX=209;
ballY=270;
ballDX=-8;
ballDY=-8;
tmpRL=193;
missFLG=0;
index=setTimeout("
functionchc(bno,bcl){
eval(((bno<
=10)?
"
b0"
:
b"
)+(bno-1)).bgColor=planecol[bcl];
functionEndBall(){
gameFLG=0;
loadFLG=0;
if(ballnum<
=0){
endgame.style.posTop=250;
endgame.style.posLeft=260;
ballcol=40;
/script>
--案例代码1结束-->
--案例代码2开始-->
with(document){
write("
tableid='
bgIE'
width='
394'
height='
240'
bgcolor='
#33CC99'
>
td>
/td>
/table>
"
);
wr
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- JS 双人 小游戏 源码
![提示](https://static.bdocx.com/images/bang_tan.gif)