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

204
Views
How to handle collisions in Phaser

I want to make objects push away from each other in my Phaser game (arcade physics). To do so I've tried to use the collider function:

  let avatar = this.physics.add.sprite(
    localStorage.x ? localStorage.x*1 : 300,
    localStorage.y ? localStorage.y*1 : 300,
    "avatar",
    0
  );

let tree = this.physics.add.image(100, 0, "bigtree");
  tree.setScale(4, 4);
  tree.setImmovable();
  this.physics.add.collider(avatar, tree); 

But I always get TypeError: undefined is not an object (evaluating 't.isParent')

It looks like this is error rises during the update process as it's risen thousand times a minute…

I'm using Phaser 3

Does anyone know the answer?

Thanks!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Turns out you have to put those collider functions in the update loop…

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!