• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by samme

  1. Look at the Follow examples in The biggest difference is that in Phaser 3 you'll be using this.cameras.main.
  2. You're right that checking body.touching won't work continuously because after the two bodies are separated during the first step, they are no longer touching on the second step. So the player would still be pushing on every other step: So you have to use immovable on the wall (commented out in linked pen).
  3. Demo
  5. I would avoid the Phaser 2 examples for now because it will just make it more confusing to learn. Did you do Making your first Phaser 3 game? That will get you started with physics, which is what your example is missing.
  6.\arcade\move to pointer.js
  7. immovable bodies can still move. They just can't be moved by collisions. In that example, you need to check player.body.touching.* before setting the player's velocity.
  8.\arcade\sprite vs immovable.js Set bounce of the moving body to 0 to stop its movement also.
  9. That looks right. You can also use mass in the group create config. You might have to use a custom collision callback for the pushing part. The fall-through is a drawback of Arcade Physics. It doesn't stack objects well. And it may be worse here because the larger mass moves the player more during the collision..
  10. Not friction, but try increasing the boxes' mass.
  11. It's done by the group (bullets), which has its own reference to the scene.
  12. There's no equivalent, but you can set hitArea and hitAreaCallback in GroupCreateConfig. Same values you would use in setInteractive().
  13. In the example the bullets are created by bullets.get() [91].
  14. Turn on physics debug.
  15. Tilemap layers or individual tiles?
  16.\background color.js
  18. samme

    Can't restart game?

    It's from calling animations.add(…) again with the same keys. A common approach is using a dedicated scene for loading assets and animations that runs only once.
  19. config/game destroy.js
  20. Could you just put it in a scene? function preload() { let mapSize = 64; let tileSize = 4; this.load.json('map', 'http://localhost:5000/map?size=' + mapSize + '&tileSize=' + tileSize + '&img=0'); } function create() { let map = this.cache.json.get('map'); let empire = makeGame(map, mapSize, tileSize); // … }
  22. Use this.registry from a scene.
  23.\background color interpolate.js
  24. If you use childSprite.addChild(mask) etc. I believe it should work in the latest Phaser CE.
  25. OK, it turns out Phaser.Physics.Arcade.StaticBody#drawDebug draws a rectangle no matter what the body shape. You could try Phaser.Physics.Arcade.StaticBody.prototype.drawDebug = Phaser.Physics.Arcade.Body.prototype.drawDebug;