Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

224
Vistas
Cannot add gravity to coins, may be because they are a staticGroup
  coins = this.physics.add.staticGroup();
  coins.create(425, 325, 'coin').setScale(0.05)
  coins.create(35, 175, 'coin').setScale(0.05)
  coins.create(750, 35, 'coin').setScale(0.05)
  coins.create(1200, 150, 'coin').setScale(0.05)
  coins.create(900, 875, 'coin').setScale(0.05)
  coins.create(1850, 875, 'coin').setScale(0.05)
  coins.create(1850, 725, 'coin').setScale(0.05)
  coins.create(1000, 425, 'coin').setScale(0.05)
  coins.create(1650, 575, 'coin').setScale(0.05)
  coins.create(400, 580, 'coin').setScale(0.05)
  coins.create(100, 875, 'coin').setScale(0.05).refreshBody();
  this.physics.add.collider(coins, platforms);
  coins.body.setAllowGravity(true); 

I would like to add gravity to the coins in my game but I think that using a staticGroup makes it impossible to add gravity, please help me add gravity to these coins. I have tried using arcadeGroup but I may have been doing it wrong. Any help is appreciated. Also if the question needs work I am happy to hear feedback. The coins just fall through the platforms and freeze the player as soon as the game starts

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Why don't you use this.physics.add.group(); for the coins.
You will not have to call the functions setAllowGravity and refreshBody on the created objects, when you use the "normal"/dynamic group.

here is the link to the documentation.

And here a link to a good phaser example / working demo: https://phaser.io/examples/v3/view/physics/arcade/basic-platform#

Information: the freezing ot the player is probably an error, you could check the browser debug console.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda