How can I prevent my character from crossing the ground?

I experimented with modifying the “First Game” code.

Look at the gravity of 1800.

var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
    default: 'arcade',
    arcade: {
        gravity: { y: 1800 },
        debug: false
    }
},
scene: {
    preload: preload,
    create: create,
    update: update
}
};

Created objects.

platforms.create(400, 568, 'ground').setScale(2).refreshBody();
player = this.physics.add.sprite(100, 450, 'dude');
player.setBounce(0);
player.setCollideWorldBounds(true);

Collider settings

this.physics.add.collider(player, platforms);
this.physics.add.collider(stars, platforms);
this.physics.add.collider(player, stars);

result
Collision with the star works but the character passes through the ground.

Q: How can I prevent my character from crossing the ground?

@dbckd9991

not sure if you are missing code or not but looking at the tutorial and your code you are missing

platforms = this.physics.add.staticGroup();

** apologies, i think my kid accidentally flagged your post :slightly_frowning_face:

Oh sorry. It seems that the question was not detailed. This article will be rewritten.
It was an unusual experience to be reported at the first post. :smile:

I’m not an expert at this, but I don’t think your platforms have physics.

I decided to solve the problem in another way.
Thank you for the answers!

Can you share how you solved it, so others can learn from this? I actually am having the same issue right now and I’m pretty sure it’s because I’m not using staticGroup at all, just an immovable sprite.