惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
量子位
aimingoo的专栏
aimingoo的专栏
V
Visual Studio Blog
Y
Y Combinator Blog
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Security Blog
Microsoft Security Blog
B
Blog
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
博客园 - 聂微东
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks

博客园 - 布袋

Phaser游戏框架与HTML Dom元素之间的通信交互 Phaser Matter Collision Plugin 碰撞插件 -- iFiero技术分享 Phaser3跟随自定义路径移动的赛车 -- iFIERO游戏教程 用EC5/EC6自定义class的区别及用法 -- Phaser3网页游戏框架 Phaser3让超级玛丽实现轻跳、高跳及加上对应的跳跃声音 Phaser3游戏三角学应用--一只跟随屏幕点击位置游动的鱼 Phaser3 对象池随机产生炸弹并销毁 Phaser3 场景Scene之间的传值 -- HTML JAVASCRIPT 网页游戏开发 Phaser3 屏幕适配iPhoneX、iPhoneXs的坑 -- JavaScript Html5 游戏开发 GameplayKit的GKStateMachine用法与实例 适配iPhoneX、iPhoneXs、iPhoneXs Max、iPhoneXr 屏幕尺寸及安全区域 Swift使用AVAudioPlayer来调节游戏的背景音乐大小 学好三角学(函数) — SWIFT和JAVASCRIPT游戏开发的必备技能 iFIERO.com 应用UserDefaults储存游戏分数和最高分 一步一步图文介绍SpriteKit使用TexturePacker导出的纹理集Altas SpriteKit在复制节点时留了一个巨坑给开发者,需要开发者手动把复制节点的isPaused设置为false 运用GamePlayKit的GKEntity及GKComponent 的iOS游戏开发实例 SpriteKit手机游戏摇杆JoyStick的使用 -- by iFIERO游戏开发教程 SpirteKit深度复制SKSpriteNode节点及convert转换其它Scene上的节点到当前场景坐标
PHASER3 设置场景SCENE SLEEPING休眠和WAKE唤醒
布袋 · 2018-11-20 · via 博客园 - 布袋

A good way to set scene stop when hidden and run while visible again !

使用sleep和wake方法的好处:

1.可以彻底让scene场景彻底休眠
2.update function不会再运行
3.同时会暂停场景内的Timer事件

GameScene.js代码

// phaser version 3.15.0
// 监听是否当前场景不可见/最小化
        this.sys.game.events.on('hidden', function () {
            console.log('pause spawn bomb while hidden');
            console.log('gamescene is sleeping?', this.scene.isSleeping('GameScene'));
            console.groupEnd();
            game.scene.keys['GameScene'].sys.sleep();

        }, this);

// 回到当前场景
        this.sys.game.events.on('visible', function () {
            console.log('spawn bomb while visible');
            console.groupEnd();
            console.log('gamescene is wake again:', this.scene.isSleeping());
            game.scene.keys['GameScene'].sys.wake();
            this.createCheckNetWork();
        }, this);

更多游戏教程:www.iFIERO.com – 为游戏开发深感自豪