KevinYen

Members
  • Content count

    7
  • Joined

  • Last visited

About KevinYen

  • Rank
    Newbie
  • Birthday 11/09/1991

Contact Methods

  • Twitter
    k387259
  • Skype
    k387259

Profile Information

  • Gender
    Male
  • Location
    Taiwan
  • Interests
    Coding

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I want to restart game scene, and I hope that it doesn't occur memory issue. Code_1: create() { for (var i = 0; i < 1000; i++) { group.get(Math.random() * 640, Math.random() * 360).anims.play(animKey); } this.input.keyboard.on("keydown_A", (event) => { this.scene.start(sceneKey); }); } When I press keydown_A 10 times, look following snapshot, memory will never release Why occur this? Because AnimationManager never run sprite.anims.remove function. So sprite's reference will keep in game.anims._events. There are 2 ways to release memory: First: We need to implement shutdown function to game scene, and remove AnimationManager's events. create() { this.events.once("shutdown", this.shutdown, this); for (var i = 0; i < 4000; i++) { group.get(Math.random() * 640, Math.random() * 360).anims.play(animKey); } this.input.keyboard.on("keydown_A", (event) => { this.scene.start(sceneKey); }); } shutdown() { game.anims.removeAllListeners(); } Second: To implement onDestroy function on every sprite. create() { for (var i = 0; i < 4000; i++) { var sp = group.get(Math.random() * 640, Math.random() * 360).anims.play(animKey); sp.once("destroy", function () { sp.anims.destroy(); }); } this.input.keyboard.on("keydown_A", (event) => { this.scene.start(sceneKey); }); } Finally, I want to ask one question. Why Phaser3 game engine call sprite.destroy and sprite.anims.destroy in passing? ( phaser-3.10.1\src\gameobjects\sprite\Sprite.js, phaser-3.10.1\src\gameobjects\GameObject.js ) I need to implement it by myself. But Phaser2 will release all of sprite used memory( When I restart Level ).
  2. Thanks a lot. sharks I found one way to keep gameobject across another scenes. gameObject.ignoreDestroy = true; and when you go across another scene, you need to setup displayList. this.sys.displayList.add(gameObject); If I want to clear all game objects, just shutdown this scene. (start another scene or restart) (if gameObject.ignoreDestroy == false)
  3. KevinYen

    Is there ScaleManager in Phaser 3

    If you want to SHOW_ALL, you can use .css to implement it html, body { height: 100%; } body { margin: 0; padding: 0; background: white; } canvas { width: 100%; height: 100%; object-fit: contain; }
  4. In Phaser2 We can use game.world.removeAll(true); or game.state.start(key, true, false); And how do I do same function in Phaser3 ?
  5. KevinYen

    The Phaser 3 Wishlist Thread :)

    Will Typescript still supported on Phaser 3 Release version ? I hope release version can provide Typescript definition files to develop game? Thanks alot.
  6. KevinYen

    Compressed Texture with Atlas

    1. Load compressed texture as arraybuffer game.load.binary(key, url) 2.Load atlas data (json file) game.load.json(key, url) 3.Add frameData & atlasData to game.cache.image