美文网首页
Phaser3 Scene切换及animation记录

Phaser3 Scene切换及animation记录

作者: 宇拓信息 | 来源:发表于2018-05-26 20:59 被阅读0次

记录一、场景的构造

    Game构造

var config = {

type: Phaser.AUTO,

parent: 'phaser-example',

width: window.innerWidth,

height: window.innerHeight,

backgroundColor: 0x444444,

scene: {

preload: preload,

create: create

}

};

// Create a new Phaser Game object

var game = new Phaser.Game(config);

多个Scene构造及切换

class boot extends Phaser.Scene{

    construtor(){

        super({

            key:"boot" //与类名一致

        })

    }

    preload(){

        //各种加载事情

    }

    create(){

        this.scene.start('另一个scene的KEY');

    }

}

动画的创建及播放

var loadinggif = this.add.sprite(width/2, height*0.4,'loadinggif');

var test = this.anims.create({

key:"test",

frames: this.anims.generateFrameNumbers('loadinggif', { start: 0, end: 31 }),

frameRate: 10,

repeat: -1

});

loadinggif.play('test');

相关文章

  • Phaser3 Scene切换及animation记录

    记录一、场景的构造 Game构造 var config = { type: Phaser.AUTO, pare...

  • Godot 实现圆环形进度条

    效果: 所需素材图片: scene: Inspector 和 Animation:

  • DragonBones

    切换动画:this._mechaArmatureComp.animation.FadeIn("skill_03",...

  • day2

    JQuery 查找 显示隐藏及切换 滑动及切换 淡入、淡出及切换 案例 轮播

  • 2018-01-09 Sprite学习笔记-1

    通过Code初始化View及Scene的方法 Sprite在scene中不考虑其他因素的自然移动,需在update...

  • git切换分支

    记录下git切换分支及相关命令 1.查看分支 查看本地分支 查看远程分支 查看所有分支 2.切换分支 如果分支存在...

  • Phaser3 场景Scene之间的传值 -- HTML网页游戏

    一、首先当然得有至少有二个场景sceneA.js,sceneB.js 二、从场景A传值到场景B二种方法 1)通过事...

  • [动画Animation和animator]

    1.区别 animation(老版)单个动画控制,占用内存小,animator(新版)控制多个动画切换占用内存大(...

  • CSS3 animation关键帧运动

    一.animation关键帧运动 设置运动规则及运动属性,并把运动规则的名称指定给相应元素 animation-d...

  • iOS swift暗黑模式适配

    暗黑模式适配 跟随系统 自定义切换 具体ui可以自己话,下面是简单的点击swtich事件 颜色设置代码 Scene...

网友评论

      本文标题:Phaser3 Scene切换及animation记录

      本文链接:https://www.haomeiwen.com/subject/decvjftx.html