纯前端小游戏,4096小游戏,有音效,Html5,可学习使用

  // 游戏开始运行
    create: function(){
        this.fieldArray = [];
        this.fieldGroup = this.add.group();
        this.score = 0;//4096 增加得分
        this.bestScore = localStorage.getItem(gameOptions.localStorageName) == null ? 0 : localStorage.getItem(gameOptions.localStorageName);
        for(var i = 0; i < 4; i++){
            this.fieldArray[i] = [];
            for(var j = 0; j < 4; j++){
                var spot = this.add.sprite(this.tileDestination(j, COL), this.tileDestination(i, ROW), "spot")
                var tile = this.add.sprite(this.tileDestination(j, COL), this.tileDestination(i, ROW), "tiles");
                tile.alpha = 0;
                tile.visible = 0;
                this.fieldGroup.add(tile);
                this.fieldArray[i][j] = {
                    tileValue: 0,
                    tileSprite: tile,
                    canUpgrade: true
                }
            }
        }
        var restartButton = this.add.sprite(this.tileDestination(3, COL), this.tileDestination(0, ROW) - 200, "restart");
        restartButton.setInteractive();
        restartButton.on("pointerdown", function(){
            this.scene.start("PlayGame");
        }, this)
        this.add.sprite(this.tileDestination(1, COL), this.tileDestin
相关推荐
小菜鸟博士18 分钟前
手撕Vision Transformer -- Day1 -- 基础原理
人工智能·深度学习·学习·算法·面试
yashunan37 分钟前
Web_php_unserialize
android·前端·php
m0_zj1 小时前
17.[前端开发]Day17-形变-动画-vertical-align
前端·css·chrome·html·html5
Edward-tan1 小时前
【玩转全栈】--创建一个自己的vue项目
前端·javascript·vue.js
Bluesonli2 小时前
UE5 蓝图学习计划 - Day 6:角色蓝图
学习·ue5·unreal engine
青年夏日科技工作者2 小时前
虚幻浏览器插件 UE与JS通信
前端·javascript·html
Bluesonli2 小时前
第 2 天:创建你的第一个 UE5 C++ 项目!
c++·学习·ue5·虚幻·虚幻引擎·unreal engine
前端达人2 小时前
「AI学习笔记」深度学习进化史:从神经网络到“黑箱技术”(三)
人工智能·笔记·深度学习·神经网络·学习
蝴蝶不愿意2 小时前
《苍穹外卖》项目学习记录-Day10来单提醒
学习
雷神乐乐2 小时前
创建前端项目的方法
前端·javascript·vue.js