消除蛋蛋派

欢迎来到程序小院

消除蛋蛋派

玩法:消除游戏,三个相同形状的蛋蛋连成一条直线即可消除,点击鼠标左键移动球球进行消除,
可以使用道具,共有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.mfbz.cn/a/264406.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

3. BlazorSignalRApp 结合使用 ASP.NET Core SignalR 和 Blazor

参考&#xff1a;https://learn.microsoft.com/zh-cn/aspnet/core/blazor/tutorials/signalr-blazor?viewaspnetcore-8.0&tabsvisual-studio 1.创建新项目 BlazorSignalRApp 2.添加项目依赖项 依赖项&#xff1a;Microsoft.AspNetCore.SignalR.Client 方式1 管理解决方案…

c语言:文件操作(2),认识各种文件操作函数

fgets 作用 fgets是C语言标准库中用于从文件中读取字符串的函数。 fgets函数从指定的文件流stream中读取最多n-1个字符&#xff0c;或者直到遇到换行符&#xff08;包括换行符在内&#xff09;&#xff0c;并将其存储到以str指向的字符数组中。读取的字符串会以null字符\0结…

模拟电路基础知识经典 200问,收藏这些就够了!

大家总说模电知识总是学不会&#xff0c;IC修真院为大家整理了模电经典200问&#xff0c;看看你掌握了多少&#xff0c;文末可以获取全部哦。 文末可领全部文档 1、半导体材料制作电子器件与传统的真空电子器件相比有什么特点? 答&#xff1a;频率特性好、体积小、功耗小&…

信息收集 - 谷歌hack

搜索引擎 FOFA网络空间测绘:https://fofa.info/ FOFA(FOcus on Assets)是一个网络空间搜索引擎,可以帮助用户快速定位和收集特定目标的信息。 ZoomEye:https://www.zoomeye.org ZoomEye 是一个网络空间搜索引擎,可以用于发现和收集特定目标的网络设备、Web应用程序、开放…

OpenCV-Python(18):图像梯度

目录 背景介绍及应用 学习目标 原理 Sobel算子和Scharr算子 Laplacian 算子 代码示例 重要提醒 背景介绍及应用 图像的梯度是指图像中每个像素点的强度变化情况。计算图像的梯度可以帮助我们了解图像中物体的边界和纹理等信息。梯度在计算机视觉和图像处理领域有着广泛…

【Amazon 实验③】Amazon WAF功能增强之追踪 Amazon WAF RequestID,排查误杀原因

文章目录 1. 方案介绍2. 架构图3. 操作演示 本实验将介绍如何利用 Amazon LambdaEdge&#xff0c;在 Amazon CloudFront 自定义错误页面 上展示每个由 Amazon WAF 返回的“403 Forbidden”错误的 Request ID。通过这个唯一的 WAF Request ID&#xff0c;网站运维工程师能够快速…

Swift 周报 第四十一期

文章目录 前言新闻和社区2024 年 Swift Student Challenge 公布现推出超过 30 个新的开发者活动 提案正在审查的提案 Swift论坛话题讨论推荐博文关于我们 前言 本期是 Swift 编辑组整理周报的第四十一期&#xff0c;每个模块已初步成型。各位读者如果有好的提议&#xff0c;欢…

不受父容器大小约束的TextView

序言 为了实现以下效果&#xff0c;特意开发了一个自定义控件。主要是红色的点赞数和评论数。 问题分析 自定义控件 该控件主要是在于忽略的父容器的大小限制&#xff0c;这样可以展示出全部内容。注意父容器的属性中需要下列配置。 package com.trs.myrb.view.count;impor…

[JS设计模式]Flyweight Pattern

Flyweight pattern 享元模式是一种结构化的设计模式&#xff0c;主要用于产生大量类似对象而内存又有限的场景。享元模式能节省内存。 假设一个国际化特大城市SZ&#xff1b;它有5个区&#xff0c;分别为nanshan、futian、luohu、baoan、longgang&#xff1b;每个区都有多个图…

Java 基础学习(十三)集合框架、List集合

1 集合框架 1.1 Collection 1.1.1 集合框架概述 Java 集合框架是一组实现了常见数据结构&#xff08;如列表、树集和哈希表等&#xff09;的类和接口&#xff0c;用于存储一组数据。 开发者在使用Java的集合类时&#xff0c;不必考虑数据结构和算法的具体实现细节&#xff…

使用selenium webdriver和mitmproxy代理模拟用户点击抓包(抓华为应用商城app数据)

文章目录 安装PythonMacWindows 安装程序需要的依赖安装chorm驱动编写代码自动化程序开始抓包 问题处理 本文简单记录一下使用selenium webdriver和mitmproxy代理模拟用户点击抓包的过程。 用于模拟真实的用户访问网站&#xff0c;达到抓包的目的。 作者水平有限&#xff0c;可…

深度解析自动化测试流程(纯干货)

今天就通过这篇文章给大家深度解析一下自动化测试的流程。 自动化测试的流程和功能测试其实挺相似的&#xff0c;整个流程也是按照需求分析及测试计划阶段、测试设计阶段、测试执行和测试总结阶段&#xff0c;总结下来就是下面一张图&#xff0c;ppt中纯手绘&#xff0c;效果不…

天猫数据分析(软件工具)-2023年11月天猫保健品行业分析报告:市场需求扩容,年轻人是主流群体

近年来&#xff0c;随着健康经济、颜值经济的兴起&#xff0c;越来越多的年轻人加入养生大军&#xff0c;成为保健食品市场上的一股新力量&#xff0c;带动市场扩容。根据鲸参谋电商数据分析平台的相关数据显示&#xff0c;今年11月份&#xff0c;天猫平台上保健食品的销量为24…

怎么提取视频中的背景音乐?

当我们在刷视频的时候&#xff0c;有时候听到一个背景音乐很好听&#xff0c;但是又不知道歌名&#xff0c;比如英语歌&#xff0c;这个时候我们很难找到这首歌&#xff0c;相信有很多朋友会遇到这样的问题&#xff0c;不知道怎么弄&#xff0c;下面小编给大家推荐一些方法帮助…

主流数据库体系结构

MySQL 我们通常所说的 MySQL 数据库服务器由一个实例&#xff08;instance&#xff09;以及一个数据库&#xff08;database&#xff09;组成。实例包括一组后台进程/线程和许多内存结构&#xff0c;用于管理数据库&#xff1b;数据库由一组磁盘文件组成&#xff0c;用于存储数…

【数论】欧拉函数

前置知识&#xff1a;分解质因数 一个数可以被分解为质因数乘积 n &#xff0c;其中的pi都是质因数 欧拉函数介绍 朴素法求欧拉函数 思路&#xff1a;边分解质因数边算欧拉函数 void get_primes() {int n; cin >> n;int ans 0;int res n;for (int i 2; i < n /…

docker部署个人网站项目记录(前后端分离)

背景 项目是前后端分离&#xff0c;前端有三部分&#xff0c;分别是 个人网站&#xff08;blog&#xff09;网站后台管理系统&#xff08;admin&#xff09;数据大屏&#xff08;datascreen&#xff09; 后端是基于nodejs写的后台服务 后台接口服务&#xff08;todo-nodejs…

表情识别-情感分析-人脸识别(代码+教程)

表情识别是计算机视觉领域中的一个重要研究方向&#xff0c;它的目标是通过分析人脸表情来判断人的情绪状态。表情识别在很多领域都有广泛的应用&#xff0c;如情感分析、人机交互、智能驾驶等。本文将从以下几个方面来阐述表情识别的相关内容。 一、表情识别的基本原理 表情识…

面试 Java 算法高频题五问五答第二期

面试 Java 算法高频题五问五答第二期 作者&#xff1a;程序员小白条&#xff0c;个人博客 相信看了本文后&#xff0c;对你的面试是有一定帮助的&#xff01; ⭐点赞⭐收藏⭐不迷路&#xff01;⭐ 寻找峰值: 主要思想&#xff1a;二分查找&#xff0c;利用get函数&#xff0…

操作系统 day15(信号量)

信号量机制 之前学习了这些解决进程互斥的方案 *但它们都无法实现“让权等待”&#xff0c;于是Dijkstra提出了一种卓有成效的实现进程互斥、同步的方法----信号量机制 总结&#xff1a;一个信号量对应一种资源。信号量的值这种资源的剩余数量&#xff08;信号量的值如果小于…