球上进攻^^

news/2025/2/14 1:13:04/

欢迎来到程序小院

球上进攻

玩法:点击鼠标走动躲避滚动的球球,球球碰到即为游戏结束,看看你能坚持多久,快去玩吧^^。

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

html

  <div id="game" class="game" style="margin: 0 auto;text-align: center;"></div>

css

.game {position: absolute;top: 0; left: 0; bottom: 0; right: 0;background-color: #fff;}

js

// 为了地震效果,将world的边界扩张一下var margin = 50;// 四边都增加一个marginvar x = -margin;var y = -margin;var w = game.world.width + margin * 2;var h = game.world.height + margin * 2;// 设置游戏区域game.world.setBounds(x, y, w, h);game.physics.startSystem(Phaser.Physics.ARCADE);// 背景var bg = game.add.image(0, 0, 'bg');// 地this.land = game.add.sprite(0, HEIGHT - 204, 'land' + this.landIndex);game.physics.arcade.enable(this.land);this.land.body.setSize(1216, 184, 0, 20);this.land.body.immovable = true;// 小人this.hero = game.add.sprite(WIDTH / 2, HEIGHT - 204 + 20);// 小人 spinevar stickman = game.add.spine(0, 0, 'stickman');stickman.scale.setTo(1.5, 1.5);stickman.setAnimationByName(0, 'Idle', true);this.hero.stickman = stickman;this.hero.addChild(stickman);// 影子this.shadow = game.add.sprite(0, stickman.bottom, 'shadow');this.shadow.anchor.setTo(0.5, 0.5);this.shadow.scale.x = stickman.width / this.shadow.width;this.hero.addChild(this.shadow);this.hero.dir = 0;game.physics.arcade.enable(this.hero);this.hero.anchor.setTo(0.5, 0.5);this.hero.body.setSize(80, 80, -40, -80);// tap数组this.hero.taps = [];game.input.onDown.add(this.tapDown, this);game.input.onUp.add(this.tapUp, this);// 球们this.balls = game.add.group();this.balls.enableBody = true;this.ballTimer = game.time.events.loop(Phaser.Timer.SECOND * 1, this.generateBall, this);this.leftBall = true;// 加分数字们this.numberItems = game.add.group();this.balls.enableBody = true;this.numberTimer = game.time.events.loop(Phaser.Timer.SECOND * 5, this.generateNumber, this);// 时间条this.gauge = game.add.sprite(0, 0, 'gauge');this.gauge.count = 0;this.gauge.scale.x = this.game.width / this.gauge.width;this.gauge.tint = Math.random() * 0xffffff;this.gaugeCropRect = new Phaser.Rectangle(0, 0, 0, this.gauge.height);this.gauge.crop(this.gaugeCropRect);this.gaugeHead = game.add.sprite(0, 0, 'gaugeHead');game.time.events.loop(Phaser.Timer.SECOND * 0.1, function() {this.gaugeHead.tint = Math.random() * 0xffffff;}, this);this.timeTimer = game.time.events.loop(Phaser.Timer.SECOND * 0.1, function() {this.gauge.count++;this.updateTimeNumber();}, this);// 时间数字this.timeIntegerText = game.add.bitmapText(this.gaugeHead.x, this.gaugeHead.bottom, 'numberTime', '0', 32);this.timeIntegerText.tint = 0x000000;this.dot = game.add.image(this.timeIntegerText.right + 2, this.gaugeHead.bottom + this.timeIntegerText.height - 5, 'white4');this.dot.tint = 0x000000;this.timeDecimalText = game.add.bitmapText(this.dot.right, this.gaugeHead.bottom, 'numberTime', '00', 32);this.timeDecimalText.tint = 0x000000;// 更改大地颜色this.floorTimer = game.time.events.loop(Phaser.Timer.SECOND * 10, function() {this.land.loadTexture("landWhite");game.time.events.repeat(Phaser.Timer.SECOND * 0.1, 10, function() {this.land.tint = Math.random() * 0xffffff;}, this);game.time.events.add(Phaser.Timer.SECOND * 1, function() {this.land.loadTexture("land" + game.rnd.integerInRange(0, 5));}, this);}, this);

源码

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

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


http://www.ppmy.cn/news/1264079.html

相关文章

线上盲盒小程序,开启互联网盲盒时代

近年来&#xff0c;盲盒经济在国内非常火爆&#xff0c;各类盲盒品牌层出不穷&#xff0c;深受国内外年轻人、消费者的喜爱。 目前&#xff0c;根据数据显示&#xff0c;盲盒市场不仅在线下异常火热&#xff0c;线上盲盒也是成为了大众的新选择。各类电商平台中盲盒的成交额更…

C语言_常见位操作

C语言_常见位操作 文章目录 C语言_常见位操作一、位操作函数二、代码示例 一、位操作函数 设置某位为1或者对某位清0、获取某位的值、对某位取反 /*对某位置1*/ unsigned Setbit(unsigned x,int n) {return x | 1 << n; }/*对某位清0*/ unsigned Resetbit(unsigned x,…

要求CHATGPT高质量回答的艺术:提示工程技术的完整指南—第 29 章:ChatGPT 插件

要求CHATGPT高质量回答的艺术&#xff1a;提示工程技术的完整指南—第 29 章&#xff1a;ChatGPT 插件 这是 ChatGPT 的另一个圣杯。它将彻底改变你使用 ChatGPT 的方式。ChatGPT 插件本质上是将 ChatGPT 的功能扩展到文本输出之外。它允许你上传图片、视频、音频和 CSV 文件&…

nginx常用笔记备忘

#user nobody; #工作进程数&#xff0c;一般设置为cpu核心数 worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { #最大连接数&#xff0c;一般设置为cpu*20…

基于Java会员管理系统

基于Java会员管理系统 功能需求 1、会员信息管理&#xff1a;该系统需要提供会员信息管理功能&#xff0c;包括会员的姓名、性别、年龄、联系方式等基本信息。同时&#xff0c;还需要提供会员的消费记录、积分、优惠券等信息的管理。 2、会员注册和登录&#xff1a;系统需要…

【开源】基于Vue+SpringBoot的固始鹅块销售系统

项目编号&#xff1a; S 060 &#xff0c;文末获取源码。 \color{red}{项目编号&#xff1a;S060&#xff0c;文末获取源码。} 项目编号&#xff1a;S060&#xff0c;文末获取源码。 目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 数据中心模块2.2 鹅块类型模块2.3 固…

服务器无法访问外网是怎么回事

1951年&#xff0c;第一台商业电子计算机UNIVAC I投入使用&#xff0c;从此主机机房进入世界。 至此60年代往后的几十年服务器被广泛运用于各个行业。随着网络技术的高速发展。TCP/IP协议奠定了互联网通讯的基础&#xff0c;使服务器在联网环境下得到广泛应用。并成为企业网络…

ArchLinux安装详细步骤

下载&#xff08;略&#xff09;安装VirtualBox&#xff08;略&#xff09;新建虚拟机&#xff08;略&#xff09;启动 进入提示符 进入安装设置界面 archinstall出现界面&#xff1a; 逐项设置。 Disk我选择了ext4 在Profile中 我选择了KDE作为桌面&#xff08;选择后按回车…