Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

215
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!