phaser3 微信小游戲入門


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

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

個人比較喜歡phaser的地方 tween,path,深度排序

 

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

修改代碼: 微信小游戲不支持blob, phaser加載image的方式需要修改.

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

其實僅需兩步就可以支持微信小游戲了。

 

一些基本的功能點:

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);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM