Help with Player Platform Collision

#1

Hello! I am new to Phaser, and will likely have a lot of rookie mistakes in my code.

For a current project I’m doing, I’ve tried to install collision between the player and a sprite that acts as the background. However, the collision code for the player and the arena fails to work. I’ve tried testing it, seeing if the issue is with the player being a prefab, or the groups themselves, but nothing seems to be working. Can you spot my error?

//character prefab

//main code



#2

Hi,

So, threse’s a lot of code to review :smiley: but don’t worry we’re going to fix this :wink:

I think that as you do an Object.create(Phaser.Sprite.prototype) your prefab is okey so I propose you to take a look at this pen

https://codepen.io/nazimboudeffa/pen/MdeOgG

Question 1 : What does refer to the keyword this in your Player object when you enable the physics like game.physics.arcade.enable(this)

Question 2 : How you manage the collision with the player in the play state if you don’t use to collide with it ?