Remove collider from the update function

hello, first i must say i’m french so i’m going to do my best, i really need your help, i’m trying to build a platform game “escape room” style, i want when my player is on the mario tube i can press the down key and he pass through the tube. i have succeed to detect when my player is on the tube but when i want to remove gravity or move the player sprite down, the game freez just as excepted, i dont konw how to do otherwise. here is the code it’s a mess but only the update part is interesting for my problem. i hope you understanding me guys and thanks for your help.

I think you forgot to add code. :sweat_smile:

let platform
let player
let cursors
let a
let b
let c
let d
let e
let f
let h
let k
let q
var jump = -480;
var g = false;
var z = 0;
var m = 0
let zeb
let bla
var des = 0;
let scoreText;

class Scene1 extends Phaser.Scene{
constructor(){
super(“playGame”);
}

preload (){
this.load.image(‘level’, ‘assets/terrain/ground.png’);
this.load.image(‘fond’, ‘assets/fond.jpg’);
this.load.image(‘kayou’, ‘assets/terrain/rock.png’);
this.load.image(‘secret’, ‘assets/interactsecret.png’);
this.load.spritesheet(‘dude’, ‘assets/dude.png’,{ frameWidth: 32, frameHeight: 48 });
this.load.audio(‘power’,‘assets/tudut.mp3’);
this.load.image(‘cadre’,‘assets/carre.png’)
this.load.image(‘pic’,‘assets/interact/spikes.png’)
this.load.image(‘cle’,‘assets/interact/keye.png’)
this.load.image(‘bonus’, ‘assets/interact/bonus.png’)
this.load.image(‘lock’,‘assets/interact/lock.png’)
this.load.image(‘bonusu’, ‘assets/interact/bonusu.png’)
this.load.image(‘coin’, ‘assets/interact/coin.png’)
this.load.image(‘mario’, ‘assets/interact/mario.jpg’)
this.load.audio(‘gta’,‘assets/gta.mp3’)
}
create(){
this.add.image(470,320, ‘fond’);
d = this.physics.add.staticGroup();
d.create(860,570, ‘secret’);
platform = this.physics.add.staticGroup({
key: ‘level’,
repeat: 12,
setXY: { x: 35, y: 605, stepX: 70 }
}
);
a = this.physics.add.staticGroup({
key: ‘level’,
repeat: 2,
setXY: { x: 175, y: 455, stepX: 70 }
}
);
b = this.physics.add.staticGroup({
key: ‘level’,
repeat: 2,
setXY: { x: 595, y: 385, stepX: 70 }
}
);
c = this.physics.add.staticGroup();
c.create(35,105, ‘level’);
h = this.physics.add.staticGroup();
h.create(175,105, ‘level’);

e = this.physics.add.staticGroup();
e.create(82,105, ‘level’);

player = this.physics.add.sprite(5,550, ‘dude’);
player.setCollideWorldBounds(true);
this.add.image(850,35, ‘cle’).setScale(1.5);

this.add.image(860,540, ‘kayou’).setScale(1.5);
this.anims.create({
key: ‘left’,
frames: this.anims.generateFrameNumbers(‘dude’, { start: 0, end: 3 }),
frameRate: 10,
repeat: -1
});

this.anims.create({
key: ‘turn’,
frames: [ { key: ‘dude’, frame: 4 } ],
frameRate: 20
});

this.anims.create({
key: ‘right’,
frames: this.anims.generateFrameNumbers(‘dude’, { start: 5, end: 8 }),
frameRate: 10,
repeat: -1
});
f = this.physics.add.image(55,20,‘cle’)
f.setBounce(0.5);

this.physics.add.collider(player, platform);
this.physics.add.collider(player, a);
this.physics.add.collider(player, b);
this.physics.add.collider(player, c, destroy, null, this);
this.physics.add.collider(platform, f);
this.physics.add.collider(f, c);
this.physics.add.collider(player, d, secret, null, this);
this.physics.add.collider(player, f, objet, null, this);
this.physics.add.collider(player,e);
this.physics.add.collider(player,h);
this.physics.add.collider(platform,zeb);

function objet(){
f.disableBody(true, true);
z = z+2;
this.add.text(865, 29, ‘I’)
var w = this.physics.add.staticImage(35,555, ‘pic’);
this.physics.add.collider(w,platform);
this.physics.add.collider(player,w,mort,null,this);
var u = this.physics.add.staticImage(735,318, ‘lock’).setScale(0.9);
this.physics.add.collider(player, u, serrure, null, this);
jump = jump +200;
o.disableBody(true, true);
}
var o = this.physics.add.staticImage(735,318, ‘lock’).setScale(0.9);
this.physics.add.collider(player,o);

function serrure (){
var k = this.physics.add.staticGroup();
k.create(455,315,‘bonus’).body.allowGravity = false;

this.physics.add.collider(player,k, bonus, null,this);
}
function bonus(player,k){
var q = this.physics.add.staticGroup();
q.create(455,315,‘bonusu’).body.allowGravity = false;

var v = this.physics.add.image(455,315,‘coin’).setVelocityY(-300).setScale(0.5);
this.physics.add.collider(player,v,money,null, this);
}
function money (player,v) {
v.disableBody(true, true);
player.setCollideWorldBounds(false);
m = m+1;
this.scene.start(“bootGame”);
}
function mort (player,w){
player.disableBody(true, true);
this.add.text(455, 300,‘GAME OVER’,{ font: ‘64px Jazz LET, fantasy’ }).setTint(0xff0000).setOrigin(0.5, 0.5);
this.add.text(455, 345,‘press F5’,{ font: ‘40px Jazz LET, fantasy’ }).setTint(0xff0000).setOrigin(0.5, 0.5);
var music = this.sound.add(‘gta’);
music.play();

}

bla = this.physics.add.staticImage(540,500,‘mario’);

//this.physics.world.removeCollider(collider)

function destroy(player, e){
e.disableBody(true, true);
}

function secret (player, d){
player.setTint(0xff0000);
jump = jump-220;
var music = this.sound.add('power');
music.play();
d.disableBody(true,true);
zeb.body.allowGravity = true;
player.x = 50;

}
if (z==2){
test();
}

cursors = this.input.keyboard.createCursorKeys();

//this.cameras.main.setBounds(0, 0, 2000 , 2000);
//this.physics.world.setBounds(0, 0, 2000, 2000);
//this.cameras.main.startFollow(player, true, 0.05, 0.05);

zeb = this.physics.add.image(500,10,‘level’);
zeb.body.allowGravity = false;
this.physics.add.collider(player, bla);
scoreText = this.add.text(16, 16, ‘score: 0’, { fontSize: ‘32px’, fill: ‘#000’ });

}
update(){
if (cursors.left.isDown)
{
player.setVelocityX(-160);

player.anims.play('left', true);

}
else if (cursors.right.isDown )
{
player.setVelocityX(160);

player.anims.play('right', true);

}
else
{
player.setVelocityX(0);

player.anims.play('turn');

}

if (cursors.up.isDown && player.body.touching.down)
{
player.setVelocityY(jump);
}
if (player.y<4010 && player.y>400 && player.x>505 && player.x<575 && cursors.down.isDown){
player.setTint(0xff0000);
}
else {
player.setTint(354032);
des = -420;
}
if (m>4){
this.add.text(455, 345,’ putain de capitaliste’,{ font: ‘30px Jazz LET, fantasy’ }).setTint(0xff0000).setOrigin(0.5, 0.5);

}
if (zeb.y<300 && zeb.y>299 ) {
}

}
}

function score () {
des = 420;
}