Jump to content

Platform doesn't collide with other platform


Mista Void
 Share

Recommended Posts

Hi guys,

I am new at phaser 3. I have a problem with collision

I don't know why my collider works fine with player and platforms

this.physics.add.collider(this.movingPlatform, this.player)
this.physics.add.collider(this.platforms, this.player)

but not with my platforms and moving platforms

this.physics.add.collider(this.platforms, this.movingPlatform)

here's how I made my platform and my new movingPlatform

// platforms

const platform = this.platforms.create(this.cameras.main.centerX, this.cameras.main.centerY + 1000'platform')
            .setOrigin(0.50.5)
            .setScale(2.5)
            .setImmovable(true);
        
        const platformBody = platform.body;
        platformBody.updateFromGameObject();

// movingPlatforms

this.spawnPlatform = this.movingPlatform.create(this.cameras.main.centerX - 800this.cameras.main.centerY + 920 - this.decrement, 'platform')
            .setOrigin(0.50.5)
            .setScale(2.5)
            .setImmovable(true);
 
            const platformBody = this.spawnPlatform.body;
            platformBody.updateFromGameObject();

Please help me to solve this problem. your response would be helpful

thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...