消除蛋蛋派

news2025/2/5 22:40:10

欢迎来到程序小院

消除蛋蛋派

玩法:消除游戏,三个相同形状的蛋蛋连成一条直线即可消除,点击鼠标左键移动球球进行消除,
可以使用道具,共有50关卡,快去闯关吧^^。

开始游戏icon-default.png?t=N7T8https://www.ormcc.com/play/gameStart/225

html

  <div id="gameContainer" style="position: relative;">
      <div id = "game"></div>
  </div>

css

*{margin:0;padding:0}
html, body
{
    -webkit-text-size-adjust:none;
    overflow: hidden;
    height:100%;
}

js

gameTimer : function(){
  this.gameTimeCounter++;
  if(this.gameTimeCounter == 1){
      this.automatedChecking();
  }
  if(!configObj.levelClear){
      if(this.monsterAnimIndex != undefined && this.monsterContainer[this.monsterAnimIndex]
      != undefined && this.monsterContainer[this.monsterAnimIndex].type != "universal" 
      && this.gameTimeCounter % 4 == 0){
          this.monsterContainer[this.monsterAnimIndex].animations.stop(true, false);
      }
      var index = Math.floor(Math.random() * 48);
      if(index != this.monsterAnimIndex && this.gameTimeCounter % 4 == 0 && 
      this.monsterContainer[index] != undefined && this.monsterContainer[index].monsterType 
      != "block"){
          this.monsterContainer[index].play('blinkEyes', 1.5, true);
          this.monsterAnimIndex = index;
      }

      if(this.startHintTimer){
          this.hintTimer++;
          if(this.hintTimer % 10 == 0 && this.startHintTimer){
              this.hintArray.splice(0, this.hintArray.length);
              this.showHint();
              this.startHintTimer = false;
          }
      }
  }
},
generateRandomNo : function(){
  this.setButtonState(true);
  for(var i = 0; i < configObj.totalRows; i++){
      for(var j = 0; j < configObj.totalCols; j++){
          this.randomNoContainer[i][j] = Math.floor(Math.random() * 6);
      }
  }
  this.verifyContainer();
},
verifyContainer : function(){
  for(var i = 0; i < configObj.totalRows; i++){
      for(var j = 0; j < configObj.totalCols; j++){
          if((j + 1)  < configObj.totalRows && this.randomNoContainer[i][j] == 
          this.randomNoContainer[i][j + 1])
          {
              if((j + 2)  < configObj.totalRows && this.randomNoContainer[i][j + 1] 
              == this.randomNoContainer[i][j + 2]){
                  this.randomNoContainer[i][j + 2] = this.replaceValue(
                  this.randomNoContainer[i][j + 2]);
              }
          }
          if((i + 1)  < configObj.totalCols && this.randomNoContainer[i][j] == 
          this.randomNoContainer[i + 1][j])
          {
              if((i + 2)  < configObj.totalCols && this.randomNoContainer[i + 1][j] == 
              this.randomNoContainer[i + 2][j]){
                  this.randomNoContainer[i + 2][j] = this.replaceValue(
                  this.randomNoContainer[i + 2][j]);
              }
          }
      }
  }
  this.generateMonsters();
},
generateMonsters : function(){
  if(this.inGameTutorial){
      this.MonsterState = " stady";
  }
  var xPos = configObj.gridStartXPos;
  for(var i = 0; i < configObj.totalRows; i++){
      for(var j = 0; j < configObj.totalCols; j++){
          if(this.currentLevelData.block.indexOf(this.index) != -1){
              this.monsterContainer[this.index] = configObj.game.add.sprite(
              xPos, this.gridStartYPos, "spriteAtlas1", "block_box.png");
              this.blockLayer.add(this.monsterContainer[this.index]);
              this.monsterContainer[this.index].imageId = 7;
              this.monsterContainer[this.index].anchor.setTo(1, 1);
              this.monsterContainer[this.index].monsterType = "block";
          }
          else if(this.powUpMonster.length > 0 && this.powUpMonster.hasOwnProperty(
          this.index)){
              if(this.powUpMonster[this.index].monsterType == "super"){
                  this.monsterContainer[this.index] = configObj.game.add.sprite(
                  xPos, 10, 'super'+this.powUpMonster[this.index].imageId);
                  this.MonsterLayer.add(this.monsterContainer[this.index]);
                  this.monsterContainer[this.index].loadTexture(
                  'super'+this.powUpMonster[this.index].imageId, 0);
                  this.monsterContainer[this.index].animations.add('blinkEyes');
                  this.monsterContainer[this.index].imageId = 
                  this.powUpMonster[this.index].imageId;
                  //combination - Type -> 3 - Normal, 4 - superMonster,
                  5 - universalMonster, Block
                  this.monsterContainer[this.index].monsterType = "super";
              }
              else{
                  this.monsterContainer[this.index] = 
                  configObj.game.add.sprite(xPos, 10, "universal");
                  this.monsterContainer[this.index].imageId = 6;
                  this.monsterContainer[this.index].monsterType = "universal";

              }
              this.monsterContainer[this.index].anchor.setTo(1, 1);
              this.monsterContainer[this.index].inputEnabled = true;
              this.monsterContainer[this.index].events.onInputDown.add(
              this.mouseDownCallBack.bind(this,this.monsterContainer[this.index]), this);
              this.monsterContainer[this.index].events.onInputUp.add(
              this.mouseUpCallBack.bind(this,this.monsterContainer[this.index]), this);
          }
          else{
              var temp = this.randomNoContainer[i][j];
              this.monsterContainer[this.index] = configObj.game.add.sprite(
              xPos, 10, 'monster'+temp);
              this.MonsterLayer.add(this.monsterContainer[this.index]);
              this.monsterContainer[this.index].loadTexture('monster'+temp, 0);
              this.monsterContainer[this.index].animations.add('blinkEyes');
              this.monsterContainer[this.index].imageId = temp;
              this.monsterContainer[this.index].anchor.setTo(1, 1);
              this.monsterContainer[this.index].inputEnabled = true;
              this.monsterContainer[this.index].events.onInputDown.add(
              this.mouseDownCallBack.bind(this,this.monsterContainer[this.index]), this);
              this.monsterContainer[this.index].events.onInputUp.add(
              this.mouseUpCallBack.bind(this,this.monsterContainer[this.index]), this);
//               combination - Type -> 3 - Normal, 4 - superMonster, 
5 - universalMonster, Block
              this.monsterContainer[this.index].monsterType = "normal";
          }
          configObj.objYPositionContainer.push(this.gridStartYPos);
          xPos += configObj.gapBetweenObj;
          this.index++;
      }
      this.gridStartYPos += configObj.gapBetweenObj;
      xPos = configObj.gridStartXPos;
  }
  this.powUpMonster.splice(0, this.powUpMonster.length);
  this.containerSize = this.monsterContainer.length;
  if(this.currentLevelData.jelly.length > 0 && this.jellyContianer.length == 0){
      for(var i = 0; i < this.currentLevelData.jelly.length; i++){
          this.jellyContianer[i] = configObj.game.add.sprite(
          this.monsterContainer[this.currentLevelData.jelly[i]].x, 
          configObj.objYPositionContainer[this.currentLevelData.jelly[i]],
          "spriteAtlas1", "jelly.png");
          this.jellyContianer[i].anchor.setTo(1, 1);
          this.jellyLayer.add(this.jellyContianer[i]);

          this.jellyBreakContianer[i] = configObj.game.add.sprite(
          this.monsterContainer[this.currentLevelData.jelly[i]].x, 
          configObj.objYPositionContainer[this.currentLevelData.jelly[i]], 
          'jelly_animation');
          this.jellyBreakContianer[i].anchor.setTo(0.6, 0.63);
          this.jellyBreakContianer[i].loadTexture('jelly_animation', 0);
          this.jellyBreakContianer[i].animations.add('jelly_animation');
          this.jellyBreakContianer[i].visible = false;
          this.jellyLayer.add(this.jellyBreakContianer[i]);
      }
  }
  this.startDropAnim();
},

源码

需要源码请关注添加好友哦^ ^

转载:欢迎来到本站,转载请注明文章出处https://ormcc.com/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1328087.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Python爬取电影天堂

前言&#xff1a; 本文非常浅显易懂&#xff0c;可以说是零基础也可快速掌握。如有疑问&#xff0c;欢迎留言&#xff0c;笔者会第一时间回复。 一、爬虫的重要性&#xff1a; 如果把互联网比喻成一个蜘蛛网&#xff0c;那么Spider就是在网上爬来爬去的蜘蛛。网络蜘蛛通过网页的…

FFmpeg windows安装与使用

FFmpeg下载&#xff1a; 1、进入ffmpeg官网&#xff0c;点击“Download”。官网地址&#xff1a;FFmpeg 2、选择对应环境的编译工具&#xff0c;如下载windows环境下的ffmpeg编译工具 3、点击下载编译好的ffmpeg工具 FFmpeg使用&#xff1a; 1、将ffmpeg编译的bin文件复制出来…

如何用Excel制作一张能在网上浏览的动态数据报表

前言 如今各类BI产品大行其道&#xff0c;“数据可视化”成为一个热门词汇。相比价格高昂的各种BI软件&#xff0c;用Excel来制作动态报表就更加经济便捷。今天小编就将为大家介绍一下如何使用葡萄城公司的纯前端表格控件——SpreadJS来实现一个Excel动态报表&#xff1a; 实…

uniapp 添加分包页面,配置分包预下载

为什么要分包 ? 分包即将小程序代码分成多个部分打包&#xff0c;可以减少小程序的加载时间&#xff0c;提升用户体验 添加分包页面 比较便捷的方法是使用vscode插件 uni-create-view 新建分包文件夹 以在我的页面&#xff0c;添加分包的设置页面为例&#xff0c;新建文件夹 s…

五、Microsoft群集服务(MSCS)环境的搭建

一、【目的】 学会利用Windows Server布置群集环境。 二、【设备】 FreeNAS11.2&#xff0c;Windows Server 2019 三、【要求】 学会利用Windows Server布置群集环境&#xff0c;掌握处理问题的能力。 配置表&#xff1a; 节点公网IP(public)内网IP(private)群集IP(clust…

RocketMQ系统性学习-RocketMQ高级特性之文件恢复与 CheckPoint 机制

&#x1f308;&#x1f308;&#x1f308;&#x1f308;&#x1f308;&#x1f308;&#x1f308;&#x1f308; 【11来了】文章导读地址&#xff1a;点击查看文章导读&#xff01; &#x1f341;&#x1f341;&#x1f341;&#x1f341;&#x1f341;&#x1f341;&#x1f3…

理解AI思维链:AI领域的核心概念及其意义

理解AI思维链&#xff1a;AI领域的核心概念及其意义 引言AI思维链的定义AI思维链的重要性实际应用案例分析面临的挑战与未来展望结语 引言 在这个日益由数据驱动的时代&#xff0c;人工智能&#xff08;AI&#xff09;已经成为科技领域的一颗耀眼的明星&#xff0c;其影响力遍…

TG5032CGN TCXO / VC-TCXO(超高稳定10pin端子型)

TG5032CGN 晶振是EPSON推出的一款额定频率10MHz至40MHz的石英晶体振荡器&#xff0c;该型号采用互补金属氧化物半导体技术&#xff0c;输出波形稳定可靠。外形尺寸为5.0 3.2 1.45mm具有小尺寸,高稳定性。该款晶体振荡器&#xff0c;可以在G&#xff1a;-40C至 85C的温度内稳定…

达梦到达梦的外部链接dblink(DM-DM DBLINK)

一. 使用场景&#xff1a; 部链接对象&#xff08;LINK&#xff09;是 DM 中的一种特殊的数据库实体对象&#xff0c;它记录了远程数据库的连接和路径信息&#xff0c;用于建立与远程数据的联系。通过多台数据库主库间的相互通讯&#xff0c;用户可以透明地操作远程数据库的数…

v-if与v-show的区别

v-if指令可以控制一个元素的显示和隐藏&#xff0c;那么它是如何实现的&#xff1f;它和看起来很像的v-show指令有什么区别呢&#xff1f; 如果v-if指令的值为假&#xff0c;那么这个元素不会被插入DOM。 下面的代码 <div v-if"true">one</div><div…

海外社媒营销新趋势,品牌出海如何做?

社交媒体在网上的影响力是毋庸置疑的。投资社交媒体平台并建立公司形象&#xff0c;提高产品运营收入&#xff0c;提升品牌知名度&#xff0c;对于吸引对您所提供的产品感兴趣的人至关重要。 然而&#xff0c;社交媒体格局总是在变化&#xff0c;这意味着您需要掌握新的社交媒…

【Jmeter】循环执行某个接口,接口引用的参数变量存在规律变化

变量设置成下面的值即可 ${__V(supplierId_${supplierIdNum})}

【项目问题解决】% sql注入问题

目录 【项目问题解决】% sql注入问题 1.问题描述2.问题原因3.解决思路4.解决方案1.前端限制传入特殊字符2.后端拦截特殊字符-正则表达式3.后端拦截特殊字符-拦截器 5.总结6.参考 文章所属专区 项目问题解决 1.问题描述 在处理接口入参的一些sql注入问题&#xff0c;虽然通过M…

基于SSM的在线学习系统的设计与实现论文

基于SSM的在线学习系统的设计与实现 摘要 随着信息互联网购物的飞速发展&#xff0c;一般企业都去创建属于自己的管理系统。本文介绍了在线学习系统的开发全过程。通过分析企业对于在线学习系统的需求&#xff0c;创建了一个计算机管理在线学习系统的方案。文章介绍了在线学习…

研究生课程 |《数值分析》复习

搭配往年真题册食用最佳。

SpringMVC:整合 SSM 上篇

文章目录 SpringMVC - 03整合 SSM 上篇一、准备工作二、MyBatis 层1. dao 层2. service 层 三、Spring 层四、SpringMVC 层五、执行六、说明 SpringMVC - 03 整合 SSM 上篇 用到的环境&#xff1a; IDEA 2019&#xff08;JDK 1.8&#xff09;MySQL 8.0.31Tomcat 8.5.85Maven…

Linux磁盘空间不足扩展

先在虚拟机Vmware上扩展磁盘空间 后将fdisk 进行分区之后&#xff0c;在/dev/中找不到新分区文件 3.创建物理卷pv时发现找不到/dev/sda3分区&#xff0c;通过ls查看确认在/dev/中没有找到新分区文件 4.解决方法 执行&#xff1a;partprobe 再查看/dev中是否可以看到新分区文件…

linux中playbook的控制语句

本章主要介绍 playbook中的控制语句。 使用 when 判断语句 block-rescue判断 循环语句 一个play中可以包含多个task&#xff0c;如果不想所有的task全部执行&#xff0c;可以设置只有满足某个 条件才执行这个task&#xff0c;不满足条件则不执行此task。本章主要讲解when 和 …

python:删除空白

删除字符串末尾的空白 例如&#xff0c;下面的代码&#xff0c;变量hobby指向的字符串在末尾有一个空格&#xff1a; 可以使用函数rstrip()删除字符串末尾的空格&#xff0c;如下&#xff1a; 因为删除字符串末尾的空格并没有赋值给原变量hobby&#xff0c;所以此时查看hobb…

众和策略股市行情分析:股市里什么叫外资?外资股是什么?

股市里什么叫外资&#xff1f; 外资就是指的国外本钱&#xff0c;即国外出资者参与到我国股市所投入的本钱。通常情况下&#xff0c;外资主要靠直接或直接持有我国股市的股票来达成注入本钱的意图。比较于内资&#xff0c;外资更多的注重于我国商场的整体情况&#xff0c;采用…