• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by samme

  1. samme

    Can't restart game?

    No imports, you just need to reference the keys (names) themselves. See the scenes in
  2.\physics\arcade\custom separate.js
  3. You need only one debug graphic per scene. Try to get it working that way, separate from any custom physics class. Create once, then clear and draw during update. Use the scene methods only. Usually it should be the topmost (last) object in the scene. You can use console.log(this.children.list); at the end of scene create() to check this.
  4. It's not actually momentum exchange that's the problem, it's the separation. You need to do some kind of predictive collision check after processing player input.
  5. Look at the Follow examples in The biggest difference is that in Phaser 3 you'll be using this.cameras.main.
  6. 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).
  7. Demo
  9. 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.
  10.\arcade\move to pointer.js
  11. 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.
  12.\arcade\sprite vs immovable.js Set bounce of the moving body to 0 to stop its movement also.
  13. 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..
  14. Not friction, but try increasing the boxes' mass.
  15. It's done by the group (bullets), which has its own reference to the scene.
  16. There's no equivalent, but you can set hitArea and hitAreaCallback in GroupCreateConfig. Same values you would use in setInteractive().
  17. In the example the bullets are created by bullets.get() [91].
  18. Turn on physics debug.
  19. Tilemap layers or individual tiles?
  20.\background color.js
  22. 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.
  23. config/game destroy.js
  24. 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); // … }