JavaScript实现打砖块游戏
本文实例为大家分享了JavaScript实现打砖块游戏的具体代码,供大家参考,具体内容如下
html+css部分
打砖块 *{ padding:0; margin:0; } .content{ position:relative; width:800px; height:600px; background-color:#999; margin:0auto; overflow:hidden; } .game{ position:relative; width:550px; height:500px; background-color:pink; margin:20pxauto0; } .brick{ position:absolute; width:50px; height:20px; background-color:blueviolet; } .flap{ position:absolute; width:120px; height:30px; bottom:0; left:0; background-color:blue; } .ball{ position:absolute; width:30px; height:30px; bottom:30px; left:0; border-radius:50%; background-color:greenyellow; } .btn{ position:absolute; width:550px; height:50px; bottom:0; left:125px; } .btnbutton{ width:120px; height:40px; } #score{ position:absolute; width:80px; height:30px; right:0; top:10%; background-color:#fff; /*border:1pxsolidred;*/ }