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);
相关文章
相关标签/搜索