Christian981

Members
  • Content Count

    8
  • Joined

  • Last visited

  1. Hello, I am making a top down zombie shooter in Phaser 3. I am using the moveToObject function to make zombies follow the player. Now I want to make healthbars for the zombies. I have read that you can use containers to make the enemies and healthbars move together but I am having trouble to move the container with moveToObject. Is it possible to move a container with the moveToObject function or should I use something else instead?
  2. I have an enemy with a health bar. I want the health bar to move with the enemy. To do this I have made a container like this: var container = scene.add.container(x, y, [enemy, healthBar]); This work just as expected, the problem is when I try to move the container with moveToObject like this: scene.physics.moveToObject(container, player, speed); This does not work at all. How do I solve this?
  3. I am making a top down zombie shooter and I am using the moveToObject function for the zombies to follow the player but as you can see, as soon as the player walks behind a wall the zombies get stuck. Is there an easy way to fix this issue?
  4. I am trying to make a snow effect on the main menu using the particle emitter but particles spawn way to fast. I have this code: var particles = this.add.particles('snow'); var emitter = particles.createEmitter({ speedY: { min: 15, max: 40 }, gravityY: 0, scale: 0.2, quantity: 1, lifespan: { min: 28000, max: 30000 }, emitZone: { source: new Phaser.Geom.Line(-20, -100, 820, -100 )} }); And quantity is only one, so I do not know how to fix this.
  5. I have this code: scene.physics.add.overlap(spears.children.entries[numberOfSpearThrowerMachines], platforms, stopSpear, null, this); function stopSpear(number) { spears.children.entries[number].setVelocityX(0); } I am trying to send a parameter to the function stopSpear when calling it. Like this: scene.physics.add.overlap(spears.children.entries[numberOfSpearThrowerMachines], platforms, stopSpear(numberOfSpearThrowerMachines), null, this); but this does not work obviously, so how do I do it instead?
  6. I must be doing something wrong. I added this code: boxes.children.iterate(function (child) { child.setMass(10); }); and it is still very easy for the player to move the boxes but when the box falls on top of the players head, the player falls through the ground. Is the code above the wrong way to set mass or am I doing something else wrong?
  7. I'm making a game in phaser 3 using the arcade physics and I want the player to be able to move boxes. The player can move the boxes right now but they are to light. Can I solve this with friction between the boxes and the platforms, and if so how do I do that? Here is my code: platforms = this.physics.add.staticGroup(); platforms.create(180, 588, 'platform3').setScale(0.5).refreshBody(); platforms.create(580, 450, 'platform4').setScale(0.5).refreshBody(); platforms.create(980, 450, 'platform4').setScale(0.5).refreshBody(); platforms.create(1280, 450, 'platform4').setScale(0.5).refreshBody(); boxes = this.physics.add.group({ key: 'box', repeat: 9, setXY: { x: 100, y: 0, stepX: 180 } }); this.physics.add.collider(boxes, platforms); this.physics.add.collider(boxes, boxes);