samme

Members
  • Content Count

    2160
  • Joined

  • Last visited

  • Days Won

    24

Everything posted by samme

  1. There's no viewPort method. Make sure you have the console open to catch errors!
  2. If you have physics bodies with collideWorldBounds=true they will be immediately moved inside the physics world bounds if they were created outside it. If you change the camera bounds such that the camera is outside them them it will immediately move to the nearest edge. If you have the camera follow a sprite it will move immediately (unless lerped) to center on the sprite. I would try to get everything in your game positioned as you want first before configuring the camera at all, because it can get confusing once the camera starts moving.
  3. I tried the same on http://labs.phaser.io/view.html?src=src/game objects\tilemap\static\create from objects.js and it worked, so I'm not sure. Turn on physics debugging and debug-draw the tilemap layer (see the examples). That will show you if the sprites have physics bodies and if the tile collision edges are correct. Technically I think you should be doing this.enemies = this.physics.add.group(); this.enemies.addMultiple( map.createFromObjects('enemies_objects', 'enemy1', { key: 'enemies' }) ); instead of overwriting this.enemies, but I'm not sure that will make a difference.
  4. What is the page address in your browser? Remove this:
  5. if (gameoverID == false) { if (this.boy.y > this.cameras.main.height || this.boy.y <= 0) { this.physics.pause(); } }
  6. https://developers.google.com/web/tools/chrome-devtools/rendering-tools/js-execution You might also try without forceSetTimeout.
  7. this.add.tween({ targets: enemies2.getChildren().map(function (c) { return c.body.velocity }), x: X, y: Y, // … }); or this.tweens.addCounter({ from: X1, to: X2, onUpdate: function (tween) { enemies2.setVelocityX(tween.getValue()); }, // … });
  8. Add this to the beginning of create and then look at the output: console.log(this.cache.tilemap.get('map').data); You can find the correct tileset names in there. If you have layer compression on, turn it off and reexport the map.
  9. Which properties do you want to tween?
  10. That should work. If you don't need extra params than you can just use this.enemies.create(200, 200, 'enemy_sprite'); Did it fix the hitboxes?
  11. http://labs.phaser.io/edit.html?src=src\camera\set bounds.js
  12. How are you setting the texture of the enemy sprites? If there's no texture specified when the body is created it will get the size of default one (32 × 32). You need something like class Enemy extends Phaser.GameObjects.Sprite { constructor(scene, x, y, key, frame) { super(scene, x, y, key, frame); // … } }
  13. Are you doing anything else to size/scale the enemy sprites or their textures? Because ordinarily the hitboxes should be the "right" size without you having to do anything special.
  14. You may have to use a physics group for that. Also turn on physics debugging, just in case.
  15. Phaser 3 also has camera follow with interpolation. And you can start with a small coefficient and then increase it.
  16. kill only deactivates and hides an object. You need destroy if you want to remove it permanently. Try pendingDestroy if destroying an object from a callback causes problems.
  17. Adjust the body offset or position. Fall-through happens when you enlarge the body and extend the bottom edge through the floor below.
  18. There's no this.physics.arcade object. Only this.physics. Unlike Phaser 2, there's no angleToPointer method, but you can calculate it: http://labs.phaser.io/edit.html?src=src\physics\arcade\velocity from angle.js
  19. samme

    Can't restart game?

    No imports, you just need to reference the keys (names) themselves. See the scenes in https://github.com/samme/phaser-parcel/tree/master/src/app.
  20. http://labs.phaser.io/edit.html?src=src\physics\arcade\custom separate.js
  21. 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.
  22. 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.