我设计了一个小游戏,适合消遣,操作方式如下
键盘左键向左
键盘右键向右
空格发射子弹
tip:射一下蓝色方块即可开始
代码如下:``
`
.plane {
width: 50px;
height: 50px;
background-color: red;
position: absolute;
bottom: 0;
}
.enemy-plane {
width: 50px;
height: 50px;
background-color: blue;
position: absolute;
top: 0;
}
.bullet {
width: 5px;
height: 10px;
background-color: rgb(33, 178, 219);
position: absolute;
}
#score {
font-size: 24px;
margin-bottom: 10px;
}
#lives {
font-size: 18px;
}
最后,初来洛谷,请多指教