当前位置:   article > 正文

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

纯前端小游戏,4096小游戏,有音效,Html5,可学习使用
  1. // 游戏开始运行
  2. create: function(){
  3. this.fieldArray = [];
  4. this.fieldGroup = this.add.group();
  5. this.score = 0;//4096 增加得分
  6. this.bestScore = localStorage.getItem(gameOptions.localStorageName) == null ? 0 : localStorage.getItem(gameOptions.localStorageName);
  7. for(var i = 0; i < 4; i++){
  8. this.fieldArray[i] = [];
  9. for(var j = 0; j < 4; j++){
  10. var spot = this.add.sprite(this.tileDestination(j, COL), this.tileDestination(i, ROW), "spot")
  11. var tile = this.add.sprite(this.tileDestination(j, COL), this.tileDestination(i, ROW), "tiles");
  12. tile.alpha = 0;
  13. tile.visible = 0;
  14. this.fieldGroup.add(tile);
  15. this.fieldArray[i][j] = {
  16. tileValue: 0,
  17. tileSprite: tile,
  18. canUpgrade: true
  19. }
  20. }
  21. }
  22. var restartButton = this.add.sprite(this.tileDestination(3, COL), this.tileDestination(0, ROW) - 200, "restart");
  23. restartButton.setInteractive();
  24. restartButton.on("pointerdown", function(){
  25. this.scene.start("PlayGame");
  26. }, this)
  27. this.add.sprite(this.tileDestination(1, COL), this.tileDestin

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/850113
推荐阅读
相关标签
  

闽ICP备14008679号