2048小游戏,h5,纯前端

部分代码

    //score
    var scoreSprite = game.add.sprite(10, 10);
    var scoreGraphics = game.add.graphics(0, 0);
    scoreGraphics.lineStyle(5, 0xA1C5C5);
    scoreGraphics.beginFill(0x308C8C);
    scoreGraphics.drawRoundedRect(0, 0, 70, 50, 10);
    scoreGraphics.endFill();
    scoreSprite.addChild(scoreGraphics);
    var scoreTitle = game.add.text(0, 5, "SCORE", titleStyle);
    scoreTitle.setTextBounds(0, 0, 70, 50);
    scoreSprite.addChild(scoreTitle);
    this.scoreText = game.add.text(0, 20, this.score, scoreStyle);
    this.scoreText.setTextBounds(0, 0, 70, 50);
    scoreSprite.addChild(this.scoreText);
    //best
    var bestSprite = game.add.sprite(90, 10);
    var bestGraphics = game.add.graphics(0, 0);
    bestGraphics.lineStyle(5, 0xA1C5C5);
    bestGraphics.beginFill(0x308C8C);
    bestGraphics.drawRoundedRect(0, 0, 70, 50, 10);
    bestGraphics.endFill();
相关推荐
Leyla12 分钟前
【代码重构】好的重构与坏的重构
前端
影子落人间16 分钟前
已解决npm ERR! request to https://registry.npm.taobao.org/@vant%2farea-data failed
前端·npm·node.js
世俗ˊ40 分钟前
CSS入门笔记
前端·css·笔记
子非鱼92140 分钟前
【前端】ES6:Set与Map
前端·javascript·es6
6230_1 小时前
git使用“保姆级”教程1——简介及配置项设置
前端·git·学习·html·web3·学习方法·改行学it
想退休的搬砖人1 小时前
vue选项式写法项目案例(购物车)
前端·javascript·vue.js
加勒比海涛1 小时前
HTML 揭秘:HTML 编码快速入门
前端·html
啥子花道1 小时前
Vue3.4 中 v-model 双向数据绑定新玩法详解
前端·javascript·vue.js
麒麟而非淇淋1 小时前
AJAX 入门 day3
前端·javascript·ajax
茶茶只知道学习2 小时前
通过鼠标移动来调整两个盒子的宽度(响应式)
前端·javascript·css