samme

Members
  • Content count

    1,809
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by samme

  1. samme

    Direction or facing position settings of sprite

    sprite.angle = sprite.body.angle;
  2. What is this.debugGraphic?
  3. samme

    Variable scope/declaration and 'modules'

    That's a fine way to handle variable scope to start. It's the simplest. A common way is to save values as properties of the current state: this.logo = this.add.logo(/*...*/); It does mean if you call your own methods or pass callbacks, you have to manage the calling context (this) as well. JavaScript modules are a long story: https://hacks.mozilla.org/2015/08/es6-in-depth-modules/
  4. I think in this context no replacement means nothing is done at all (leaving the current tile in place). I tried replacements=-1 and it does indeed create sprites and remove the tiles. Maybe double-check your layer arguments.
  5. samme

    How do we reload a scene in Phaser 3

    See the scene tutorials: Part 1 Part 2. A scene is an object responsible for creating, updating, and displaying its own game objects. It's instantiated only once, when it's added to the manager, but it can be started or stopped any number of times. When you stop a scene, all of its objects are destroyed, so you don't need to do that yourself. The cycle you described is pretty similar to the one in https://github.com/samme/brunch-phaser/tree/master/app/scenes. You can move through scenes with scene.start(…), which stops the current scene and starts another.
  6. samme

    Rotate Object Once

    It's because a single keypress usually is down for several update steps. You can use Phaser.Input.Keyboard.JustDown(cursors.up) etc. See http://labs.phaser.io/edit.html?src=src/input/keyboard/just down.js
  7. samme

    When and how set preserveDrawingBuffer value?

    It can be done in the game config, is that what you mean?
  8. I think you need to use replacements = -1 instead of null.
  9. samme

    Simple top-down physics questions

    You should check player.body.blocked.* and player.body.touching.* to prevent movement in those directions (left/right/up/down).
  10. samme

    How do we reload a scene in Phaser 3

    Scenes are instantiated only once, so if you really want a new instance, you have to destroy the previous scene and add a new one.
  11. https://github.com/samme/phaser-plugin-debug-body-colors Colors Arcade Physics bodies by collision state (blocked, touching, embedded).
  12. samme

    Rotating GameObject & Collider

    It is not possible, correct.
  13. samme

    Dismemberment function, any advices ?

    That sounds fine. Unless it's possible to just create separate images beforehand (in an image editor), then I would prefer that.
  14. samme

    Phaser 3 Animation Docs/Tutorials?

    Besides http://labs.phaser.io/index.html?dir=animation/?
  15. samme

    Animation from spritesheet only showing first frame

    Use scene.add.existing() instead.
  16. samme

    Rotating GameObject & Collider

    https://photonstorm.github.io/phaser3-docs/Phaser.Physics.Arcade.Body.html#rotation__anchor I can try to improve the docs on this point.
  17. You need to use add.sound() only once per sound per game. The sounds aren't removed from the manager when you change or restart states. Use game.debug.sound() to see how many are held in the manager.
  18. It looks like this warning is spurious in this case, sorry about that.
  19. The old cached texture should be "destroyed" each time a new one is created.
  20. I don't know. I was always concerned that would be a problem with runChildUpdate.
  21. samme

    Phaser Canvas overflow on div

    Unrelated, but that physics entry is for Phaser 3 only. Make sure you're using only https://photonstorm.github.io/phaser-ce/global.html#GameConfig. Game parent should have no padding. See https://photonstorm.github.io/phaser-ce/Phaser.ScaleManager.html#toc-3 Use game.debug.scale(X, Y).
  22. samme

    Scene bringToTop function v3.9.0

    https://phaser.io/phaser3/devlog/121
  23. @BdR could you please try this.game.onFocus.add(function () { window.focus(); });
  24. This sounds similar to phaser-ce/issues/236. If you never restart mspointer, you don't really need to wait until pause/resume to stop it. Just stop it when your game boots, for better consistency.