phaser3 微信小遊戲入門

phaser與eget, laya, pixi.js本質上沒什麼區別. 都是渲染引擎.  其它的都是配角. json

phaser的特色是.代碼容易理解 功能比較全面.緩存

我的比較喜歡phaser的地方 tween,path,深度排序微信

 

下面來一步一步的學習phaser,以及用phaser快速移植小遊戲app

修改代碼: 微信小遊戲不支持blob, phaser加載image的方式須要修改.學習

添加適配器. 官網上下載最新的weapp-adapter.動畫

其實僅需兩步就能夠支持微信小遊戲了。this

 

一些基本的功能點:url

1.資源加載   this.load.type(key, url);  例如>加載包資源 this.load.pack(key, value);排序

2.資源緩存   this.cache.type.get(key); 遊戲

3:查看遊戲中緩存的紋理  this.textures.getTextureKeys()

4:全局點擊事件 this.input(

5:按鈕點擊事件  button.setInteractive().on('pointer');

6:動畫建立   this.anims.create     

7:動畫播放   sprite.anim.play(key);
8:緩動        this.tweens.add(options);
9:曲線-路徑       new Phaser.Curves.Path(x, y);  有這個的引擎的很少
10:曲線-貝茲     new Phaser.Curves.CubicBezier()    new Phaser.Curves.QuadraticBezier()
11:曲線-跟隨     this.add.follower(path, x, y, key).startFollow(options);
12:骨格動畫      this.load.spine(key, 'key.json', 'key.atlas');    this.add.spine(x, y, key, animation, true);
相關文章
相關標籤/搜索