Javascript实现别踩白块儿(钢琴块儿)小游戏

游戏唯一的一个规则,我们只需要不断踩着黑色方块前进即可,这里根据方向键来踩白块

在规定时间内,每走一次分数加100


这里写图片描述


游戏内的每一排都是一个有四个元素的数组,当正确的踩到黑块前进后,前一个数组内所有的对象样式属性(backgroundColor)赋值给其后一个数组内的对应位置处的对象,便实现了前进的功能,很简单的思想

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        *{
    padding: 0;
          margin: 0;
        }
        .div_bg {
            width: 412px;
            height: 512px;
            margin-top: 10px;
            border: 1px solid black;
            box-shadow: 0px 0px 20px #102327;
        }
        #score{
            margin-top: 10px;
            color: #365669;
            margin:0 auto;
            width: 350px;
            height: 80px;
        }
        .span_1 {

            font-size: 3em;
        }

        .box_list {
            border-radius: 100%;
            text-align: center;
            line-height: 100px;
            color: red;
            font-size: 2em;
        }

        .box_list_1 {
            border-radius: 100%;
            box-shadow: 0px 0px 20px #ff5026;
            text-align: center;
            line-height: 100px;
            color: red;
            font-size: 2em;
        }
        .img{
            margin: 0 auto;
            margin-top: 15px;
        }
        .over{
            border: 2px solid #23f00f;
            border-radius: 20%;
            box-shadow: 0px 0px 5px red,0px 0px 10px blue,0px 0px 15px white;
            top: 200px;
            left: 50%;
            margin-left: -150px;
            color: black;
            line-height: 50px
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值