使用使用JS代码实现俄罗斯方块游戏代码实现俄罗斯方块游戏
主要介绍了使用JS代码实现俄罗斯方块游戏,代码简单易懂,非常不错,具有一定的参考借鉴价值,需要的朋友
可以参考下
简单的JS俄罗斯方块游戏源码,先给大家展示下效果图,如果大家感觉不错,请参考实现代码,
效果图:
代码如下,复制即可使用:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>使用JS实现俄罗斯方块游戏</title>
<style type="text/css">
.MainFrame
{
border: 1px solid burlywood;
margin: 10px auto;
position: relative;
background-color: silver;
}
.MainFramediv
{
float: left;
margin: 1px;
position: absolute;
/*z-index: -1;*/
}
.smallDiv
{
margin: 1px;
position: absolute;
}
.smallDivblack
{
/*float: left;*/
margin: 1px;
/*margin: 1px;*/
position: absolute;
/*z-index: 2;*/
}
#tetris{
width: 50%;
margin: 0 auto;
padding: 0;
/*border: 1px solid silver;*/
}
#tetris:after{
content: "";
Display: block;
Clear: both;
}
#control{
float: left;
border: 1px solid silver;
width: 150px;
height: 578px;
margin-top: 10px;
margin-left: 20px;
padding-top: 30px;
font-size: 24px;
font-weight: 400;
color: blue;
text-align: center;
}
#level,#regame{
width: 100px;
height: 30px;
border: 1px solid blue;
font-size: 16px;
color: red;
font-weight: 300;
}
#control p{