国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Phaserjs3 對(duì)象池隨機(jī)產(chǎn)生炸彈并銷毀 -- Html網(wǎng)頁游戲開發(fā)

wind3110991 / 2904人閱讀

scene.js

/// 
 
"use strict";
var BootScene = new Phaser.Class({
    Extends: Phaser.Scene,

    initialize: function BootScene() {

        Phaser.Scene.call(this, {
            key: "Boot",
            active: true // listening resize event;
        });
   
    },
    init: function () {
        console.log("init bootscene");
        this.particles = {};
    },

    preload: function () {
        this.load.image("sky", "assets/space.jpg");
        this.load.spritesheet("explode","assets/explode.png",{frameWidth:128,frameHeight:128})
  },

    create: function () {
        // this.sound.play("hitbomb");
        this.background = this.add.sprite(0, 0, "sky").setOrigin(0, 0);
        this.createExplode();
 
    },
    update:function(){
        // console.log("bootscene update");
    },
    
    createExplode:function(){
        //* single image;
        // this.add.sprite(200,200,"explode",10);
        this.anims.create({
            key: "explodeAnimation",
            frames: this.anims.generateFrameNumbers("explode", { start: 0, end: 16, first: 0 }),
            frameRate: 25,
            repeat: 0
        });
        //* pool group
        this.exploadGroup = this.add.group();
        
        this.time.addEvent({
            delay: 2500, //  
            repeat: -1,
            callbackScope: this,
            callback: this.spawnRandomExplode
        });
    },
    spawnRandomExplode:function(){
        let x = Phaser.Math.Between(10, this.sys.game.config.width);
        let y = Phaser.Math.Between(10,this.sys.game.config.height);
       // this.add.sprite(x,y,"explode").setScale(0.7).play("explodeAnimation");
        let singleExplode = this.exploadGroup.get(x,y,"explode"); //* get to pool instead of create
        singleExplode.setScale(0.7).play("explodeAnimation"); //* play animation;
        singleExplode.setActive(true);
        singleExplode.setVisible(true);

        // explosion lifespan
        this.explosionTimeEvent = this.time.addEvent({
            delay: 600, // delay 5s 刪除 this.bomb;
            repeat: 0,
            callbackScope: this,
            callback:function(){
                this.exploadGroup.killAndHide(singleExplode);
              //*  this.explosionTimeEvent.remove(false);
            }
        });
            
        
    }, 

});

效果預(yù)覽地址:http://www.iFIERO.com/uploads...

更多游戲教學(xué):http://www.iFIERO.com -- 為游戲開發(fā)深感自豪

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://specialneedsforspecialkids.com/yun/53239.html

相關(guān)文章

  • Phaserjs3 對(duì)象隨機(jī)產(chǎn)生炸彈銷毀 -- Html網(wǎng)頁游戲開發(fā)

    showImg(https://segmentfault.com/img/remote/1460000016964470); showImg(https://segmentfault.com/img/remote/1460000016964471); scene.js /// use strict; var BootScene = new Phaser.Class({ Extends...

    xushaojieaaa 評(píng)論0 收藏0
  • 無聊嗎,寫個(gè)【飛機(jī)大戰(zhàn)】來玩吧

    摘要:今天杭州又是大雨,被淋了個(gè)落湯雞,都怪我家大狼狗非要騎電動(dòng)車,我昨天吐槽要買的帥氣的雨衣還沒有買不過大雨和飛機(jī)大戰(zhàn)小游戲更配哦。微信早已正式發(fā)布微信內(nèi)置飛機(jī)大戰(zhàn)游戲,目前該游戲已經(jīng)下線。此時(shí),界面中會(huì)顯示此次玩家的飛機(jī)大戰(zhàn)分?jǐn)?shù)。showImg(https://user-gold-cdn.xitu.io/2019/5/15/16ab9377884b99f7); 今天杭州又是大雨,被淋了個(gè)落湯雞...

    李濤 評(píng)論0 收藏0
  • 無聊嗎,寫個(gè)【飛機(jī)大戰(zhàn)】來玩吧

    摘要:今天杭州又是大雨,被淋了個(gè)落湯雞,都怪我家大狼狗非要騎電動(dòng)車,我昨天吐槽要買的帥氣的雨衣還沒有買不過大雨和飛機(jī)大戰(zhàn)小游戲更配哦。微信早已正式發(fā)布微信內(nèi)置飛機(jī)大戰(zhàn)游戲,目前該游戲已經(jīng)下線。此時(shí),界面中會(huì)顯示此次玩家的飛機(jī)大戰(zhàn)分?jǐn)?shù)。 今天杭州又是大雨,被淋了個(gè)落湯雞,都怪我家大狼狗非要騎電動(dòng)車,我昨天吐槽要買的帥氣的雨衣還沒有買,不過大雨和飛機(jī)大戰(zhàn)小游戲更配哦。 這篇文章來自我司的王老吉同...

    MSchumi 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<