• 不充不行(同时跑三辆车)


    欢迎来到程序小院

    不充不行

    玩法:点击鼠标左键长按充电桩,别让车落回底线,三辆车同时在跑,要控制三个充电桩的电量,电量为0即为游戏结束,看看你能坚持多少秒哦^^。
    

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

    html

    <div id="tips"></div>
    

    css

    1. #tips{
    2.   position: fixed;
    3.   top0;
    4.   left0;
    5.   width100%;
    6.   height100%;
    7.   backgroundrgba(0,0,0,1url(assets/images/tips.png) no-repeat center center;
    8.   display: none;
    9. }

    js

    1. create: function () {
    2.         function b(c) {
    3.             a.add.tween(c).to({
    4.                 x: 500
    5.             }, 1e3"Linear"truefalse).onComplete.add(function (a) {
    6.                 a.x = 120, b(c)
    7.             }, a)
    8.         }
    9.         var c, a = this;
    10.         this.stage.backgroundColor = "#000000";
    11.         this.bg = this.add.sprite(00"bg");
    12.         this.loadNeedle = this.add.sprite(this.world.centerX + 5578"loading-needle");
    13.         this.loadNeedle.anchor.setTo(.5.5);
    14.         this.loadingo = this.add.sprite(this.world.centerX + 9575"loading-o");
    15.         this.loadingo.anchor.x = .5;
    16.         this.whitebmd = this.add.bitmapData(23030);
    17.         this.whitebmd.ctx.beginPath();
    18.         this.whitebmd.ctx.rect(00230230);
    19.         this.whitebmd.ctx.fillStyle = "#ffffff";
    20.         this.whitebmd.ctx.fill();
    21.         this.whiteSprite = this.add.sprite(this.world.centerX, this.world.height - 90
    22.         this.whitebmd);
    23.         this.whiteSprite.anchor.setTo(.5);
    24.         this.loadingMeterRed = this.add.sprite(this.world.centerX, this.world.height - 
    25.         100"loading-meter-red");
    26.         this.loadingMeterRed.anchor.x = .5;
    27.         this.loadMeter = this.add.sprite(this.world.centerX + 10this.world.height - 50
    28.         "loading-meter");
    29.         this.loadMeter.anchor.setTo(.5);
    30.         this.loadGuang = this.add.sprite(this.world.centerX, this.world.height - 458
    31.         "loading-guang");
    32.         this.loadGuang.anchor.setTo(.5);
    33.         DO.bgMusic = this.add.audio("audio-bg"1true);
    34.         this.startAudio = this.add.audio("start"1false);
    35.         DO.bgMusic.play();
    36.         this.btnStart = this.add.button(this.world.centerX, this.world.height, "btn"
    37.         nullthis000);
    38.         this.btnStart.alpha = 0;
    39.         this.btnStart.anchor.setTo(.5);
    40.         this.btnStart.inputEnabled = true;
    41.         this.btnStart.events.onInputUp.add(function () {
    42.             this.startAudio.play();
    43.             this.state.start("game");
    44.         }, this);
    45.         this.line = this.add.sprite(this.world.centerX - 44this.world.height - 60
    46.         "line");
    47.         this.line2 = this.add.sprite(this.world.centerX + 34this.world.height - 121
    48.         "line");
    49.         this.line.anchor.setTo(.5);
    50.         this.line2.anchor.setTo(.5);
    51.         this.line2.alpha = 0;
    52.         this.line.alpha = 0;
    53.         b(this.loadingMeterRed);
    54.         this.titleArr = [];
    55.         for (c = 114 > c; c++) {
    56.             this.titleArr.push(this.add.sprite(this.world.centerX, 100"title" + c));
    57.             this.titleArr[c - 1].anchor.set(.5);
    58.             this.titleArr[c - 1].alpha = 1;
    59.         }
    60.         this.titleArr = this.titleArr.sort(function () {
    61.             return Math.random() - .5;
    62.         });
    63.         for (c = 0; c < this.titleArr.length; c++) {
    64.             this.add.tween(this.titleArr[c]).to({
    65.                 alpha: 0
    66.             }, 300"Linear"true100 * c, 3true);
    67.         }
    68.         this.bgShadow = this.add.sprite(this.world.centerX, 574"bg-shadow");
    69.         this.bgShadow.anchor.setTo(.5);
    70.         this.add.tween(this.bgShadow).to({
    71.             alpha: .3
    72.         }, 1e3, Phaser.Easing.Linear.None, true0999true);
    73.         this.graphics = this.add.graphics(this.world.centerX, 578);
    74.         this.graphics.lineStyle(164497882);
    75.         this.graphics.angle = -90;
    76.         this.arcValue = 2;
    77.         this.load.onLoadStart.add(this.loadStart, this);
    78.         this.load.onFileComplete.add(this.fileComplete, this);
    79.         this.load.onLoadComplete.add(this.loadComplete, this);
    80.         this.loading();
    81.     }, descText: function (a, b, c) {
    82.         var d, e, f;
    83.         a = a.split("");
    84.         d = this.add.group();
    85.         d.x = this.world.centerX - b;
    86.         d.y = c;
    87.         for (e = 0; e < a.length; e++) {
    88.             f = this.add.text(30 * e, 120, a[e], {
    89.                 fontSize: 30,
    90.                 fill: "#d6f1ff"
    91.             }, d);
    92.             f.anchor.set(.5.7);
    93.             f.scale.y = 0;
    94.             this.add.tween(f).to({
    95.                 angle: 360
    96.             }, 300, Phaser.Easing.Linear.None, true100);
    97.             this.add.tween(f.scale).to({
    98.                 y: 1
    99.             }, 600, Phaser.Easing.Linear.None, true30 * e);
    100.         }
    101.         return d
    102.     }, arcProgress: function (a, b) {
    103.         this.time.events.remove(this.aaa);
    104.         if(this.arcValue < a) {
    105.             this.aaa = this.time.events.repeat(20, a - this.arcValue, function () {
    106.                 this.arcValue = this.arcValue + b;
    107.                 this.graphics.arc(-35172this.math.degToRad(this.arcValue++),
    108.                 this.math.degToRad(this.arcValue), false);
    109.                 this.loadGuang.angle = 356 === this.arcValue ? 360 : this.arcValue;
    110.                 this.loadNeedle.angle = 356 === this.arcValue ? 360 : this.arcValue;
    111.                 if(this.arcValue > 354) {
    112.                     this.time.events.removeAll();
    113.                     this.animProgress();
    114.                     this.loadGuang.alpha = 0;
    115.                 }
    116.             }, this);
    117.         }
    118.     }, animProgress: function () {
    119.         function b(c, d, e) {
    120.             a.add.tween(c).to({
    121.                 x: d
    122.             }, 2e3"Linear"truefalse).onComplete.add(function (a) {
    123.                 a.x = e, b(c, d, e)
    124.             }, a), a.add.tween(c).to({
    125.                 alpha: 1
    126.             }, 1e3"Linear"truefalse99true)
    127.         }
    128.         var a = this;
    129.         this.loadingMeterRed.alpha = 0this.whiteSprite.alpha = 0this.add.tween(
    130.         this.loadMeter).to({
    131.             y: this.world.height + 50,
    132.             alpha: 0
    133.         }, 800, Phaser.Easing.Quartic.In, truefalse).onComplete.add(function () {
    134.             this.add.tween(this.btnStart).to({
    135.                 y: this.world.height - 90,
    136.                 alpha: 1
    137.             }, 800, Phaser.Easing.Quartic.Out, truefalse).onComplete.add(function () {
    138.                 b(this.line, 380244), b(this.line2, 244380)
    139.             }, this)
    140.         }, this), this.descText("长按充电桩,别让车落回底线,"19060), 
    141.         this.descText("看你行不行!"70110)
    142.     }

    源码icon-default.png?t=N7T8https://www.ormcc.com/

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

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

  • 相关阅读:
    低价链接,平台投诉,你真的会吗
    数环通入选中国信通院《高质量数字化转型技术方案集(2023)》,积极推动企业数字化转型
    Android 设置默认应用
    将ppt里的视频导出来
    01. 正则表达式概述
    什么是AMQP?
    第7章 网络优化与正则化
    使用信号量解决并发问题
    CentOS7安装Kafka_2.12-3.3.1集群及使用
    day01_matplotlib_demo
  • 原文地址:https://blog.csdn.net/qq_16659821/article/details/134294031