用javascript做一个简单的弹球游戏,如何实现功能四、判断球是否被木板接住或落地。<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script type="text/javascript">var x=10,y=10,dx=5,dy=5;function f(){ if(x<0|| x>250) dx=-dx; if(y<0||y>450) dy=-dy; x+=dx; y+=dy; qiu.style.left= x; qiu.style.top= y;}window.setInterval("f()",10);function mubanMove(){ if(event.keyCode==37) muban.style.pixelLeft-=20; if(event.keyCode==39) muban.style.pixelLeft+=20;}</script></head><body onkeydown="mubanMove()" onclick="a()"><div style="width:300px;height:500px;margin:auto;border:#000 solid 1px;position:absolute;"><img id="qiu" src="1.jpg" style="position:absolute;width:50px;height:50px"/><P id="gameover" style="margin:300px 100px 200px 100px;display:none">GAMEOVER</P><img id="muban" src="2.jpg"/ style="position:absolute;top:400px;width:70px;height:10px;"></div></body></html>
添加回答
举报
0/150
提交
取消