Collision breaking and detecting nothing after working fine.

I am recreating a game I made awhile ago in another program using phaser, and I now have a weird bug with collision. Basically, when I enter a room with these enemy squares they interact normally with me, but when they get forced into one corner, I guess too many collisions occur and suddenly every collider on the map stops working, walls to enemies, enemies to player, walls to player none of it works.

Image 1 is it normally in play, the enemies home into the player.
Image 2 shows the in-between, where, since the enemies home in, I can force them to run into a corner and just pile up the collisions.
Image 3 is the direct aftermath, where the player can clip into walls, enemies can freely clip into walls, and enemies can clip into the player.



I would upload the html file, but new users can’t do that, so here is the 680 lines of source code. Just slap this baby in an html file and you are good to go.
P.S. I had to remove the comments due to character limit on posts

Edit* After I removed death from the game, the enemies that sorta glitched into causing collision to break still got destroyed by phaser.

<script>


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

    var game = new Phaser.Game(config);

    class being extends Phaser.GameObjects.Sprite {
        constructor(config) {
            super(config.scene, config.x+config.scene.dx, config.y+config.scene.dy, 'square');
            this.scene = config.scene;
            this.displayHeight = config.size[0];
            this.displayWidth = config.size[1];
            this.setTint(config.tint);
            this.speed = config.speed;
            this.health = config.health;
            this.damage = config.damage;
            this.ai = config.ai;
            this.projectile = config.projectile;
            this.movement = [0, 0];
            this.knockpower = config.knockpower;
            this.knocker = null;
            this.knockback = [0, 0];
            this.iframe = 0;
            this.invincible = false;
            this.fire = 100;
            this.firerate = config.firerate;
            this.target = config.target
            this.swap = 0;
            this.depth = 1;

            config.scene.add.existing(this);
            config.scene.physics.add.existing(this);
            if (this.speed == "wall") {

            }
        }
        mover() {
            this.body.setVelocity((this.movement[0] * this.speed)+this.knockback[0], (this.movement[1] * this.speed)+this.knockback[1]);
        }
        knockcalc() {
            let prey = [this.knocker.x, this.knocker.y];
            let predator = [this.x, this.y];
            let vector = [prey[0] - predator[0], prey[1] - predator[1]];
            let magnitude = Math.sqrt(((prey[0] - predator[0]) * (prey[0] - predator[0])) + ((prey[1] - predator[1]) * (prey[1] - predator[1])));
            this.knockback = [(vector[0] / magnitude)*-this.knocker.knockpower, (vector[1] / magnitude)*-this.knocker.knockpower];
        }
        hit(damage) {
            if (this.iframe <= 0) {
                this.health -= damage;
                this.iframe = 30;
                if (this.health <= 0) {
                    this.die();
                }
            }
        }
        die() {
            if (this.playercharacter == true) {
                this.dead = true;
            } else {
                this.destroy();
            }
        }
        invincibility() {
            if (this.iframe > 0) {
                this.iframe -= 1;
            }
            if (Math.abs(this.knockback[0]) > 1 || Math.abs(this.knockback[1]) > 1) {
                this.knockback[0] = this.knockback[0] * 0.9;
                this.knockback[1] = this.knockback[1] * 0.9;
                if (Math.abs(this.knockback[0]) < 1 || Math.abs(this.knockback[1]) < 1) {
                    this.knockback = [0, 0];
                }
            }
        }
        shoot() {
            if (this.fire == 0) {
                if (this.projectile == "Basic") {
                    let prey = [this.target.x, this.target.y];
                    let predator = [this.x, this.y];
                    let vector = [prey[0] - predator[0], prey[1] - predator[1]];
                    let magnitude = Math.sqrt(((prey[0] - predator[0]) * (prey[0] - predator[0])) + ((prey[1] - predator[1]) * (prey[1] - predator[1])));
                    this.scene.config_holder.Basic_Projectile.x = predator[0] + (vector[0] / magnitude) * 50;
                    this.scene.config_holder.Basic_Projectile.y = predator[1] + (vector[1] / magnitude) * 50;
                    var boolet = new being(this.scene.config_holder.Basic_Projectile)
                    boolet.movement = [vector[0] / magnitude, vector[1] / magnitude];
                    this.scene.enemies.add(boolet);
                    this.fire = this.firerate;
                }
            } else {
                this.fire--;
            }
        }
    }

    function preload() {
        
        this.transition = true;
        
        this.load.image('sky', 'https://images.squarespace-cdn.com/content/v1/5883caad59cc684854aef84c/1508481793651-279DZYIVW4B6DHIARAWN/A+blank.JPG?format=2500w');
        this.load.image('square', 'https://static.wikia.nocookie.net/voidapedia/images/6/61/Whitevoid.jpg/revision/latest?cb=20180309135104');
        this.load.image('YouDied', 'https://cdn141.picsart.com/315188481229211.png');
        this.load.image('map', 'https://codehs.com/uploads/55d40ea1a51c935bba4fc7e55310aef7');
        
        this.ai_holder = {
            Void: function () {
                
            },
            Runner: function () {
                let prey = [this.target.x, this.target.y];
                let predator = [this.x, this.y];
                let vector = [prey[0] - predator[0], prey[1] - predator[1]];
                let magnitude = Math.sqrt(((prey[0] - predator[0]) * (prey[0] - predator[0])) + ((prey[1] - predator[1]) * (prey[1] - predator[1])));
                this.movement = [vector[0] / magnitude, vector[1] / magnitude];
            },
            Gunner: function () {
                this.shoot();
                if (this.swap == 0) {
                    this.swap = Math.floor(Math.random() * 500);
                    this.direction = Math.floor(Math.random() * 2);
                } else {
                    this.swap--;
                }
                let prey = [this.target.x, this.target.y];
                let predator = [this.x, this.y];
                let vector = [prey[0] - predator[0], prey[1] - predator[1]];
                let magnitude = Math.sqrt(((prey[0] - predator[0]) * (prey[0] - predator[0])) + ((prey[1] - predator[1]) * (prey[1] - predator[1])));
                let unitv = [vector[0] / magnitude, vector[1] / magnitude];
                let norm1 = [-1 * unitv[1], unitv[0]];
                let norm2 = [unitv[1], -1 * unitv[0]];

                

                if (this.direction == 0) {
                    let temp = [unitv[0] * (-250 + magnitude) + norm1[0] * 50, unitv[1] * (-250 + magnitude) + norm1[1] * 50];
                    let tempm = Math.sqrt((temp[0] * temp[0]) + (temp[1] * temp[1]));
                    this.movement = [temp[0] / tempm, temp[1] / tempm];
                } else {
                    let temp = [unitv[0] * (-250 + magnitude) + norm2[0] * 50, unitv[1] * (-250 + magnitude) + norm2[1] * 50];
                    let tempm = Math.sqrt((temp[0] * temp[0]) + (temp[1] * temp[1]));
                    this.movement = [temp[0] / tempm, temp[1] / tempm];
                }
            },
            Chaser: function () {
                
                let lockon = 0.025
                let prey = [this.target.x, this.target.y];
                let predator = [this.x, this.y];
                let vector = [prey[0] - predator[0], prey[1] - predator[1]];
                let magnitude = Math.sqrt(((prey[0] - predator[0]) * (prey[0] - predator[0])) + ((prey[1] - predator[1]) * (prey[1] - predator[1])));
                this.movement = [this.movement[0]*0.99+lockon*(vector[0] / magnitude), this.movement[1]*0.99+lockon*(vector[1] / magnitude)];
                for (let i = 0; i < this.antiTarget.length; i++) {
                    let prey = [this.antiTarget[i].x, this.antiTarget[i].y];
                    let predator = [this.x, this.y];
                    let vector = [prey[0] - predator[0], prey[1] - predator[1]];
                    let magnitude = Math.sqrt(((prey[0] - predator[0]) * (prey[0] - predator[0])) + ((prey[1] - predator[1]) * (prey[1] - predator[1])));
                    if (this.antiTarget[i] != this && magnitude <150) {
                        this.movement = [this.movement[0] + (vector[0] / magnitude) * (0.00025 * (magnitude - 150)), this.movement[1] + (vector[1] / magnitude) * (0.00025 * (magnitude - 150))]
                    }
                }
            }
        }
        this.room_holder = {
            Forest_1: { Name: "Forest_1", Borders: [1, 0, 0, 0], Connect: ["Forest_2", null, null, null], Map: 'equivalent to the loaded image appropriate', Terrain: [[100, 200, 50, 50]], Special: [], Lock: [], Enemies: [] },
            Forest_2: { Name: "Forest_2", Borders: [1, 1, 1, 1], Connect: ["Forest_3", "Forest_4", "Forest_1", "Forest_5"], Map: 'equivalent to the loaded image appropriate', Terrain: [[100, 200, 50, 50]], Special: [], Lock: [], Enemies: [[50, 50, 4], [50, 500, 4], [500, 50, 4], [500, 500, 4],[200,200,4],[300,300,4],[800,50,4],[800,300,4]] }
        };
    }

    
    function create() {
        this.dx = 0;
        this.dy = 0;
        this.count = 0;

        this.player = new being({ scene: this, x: 640, y: 400, size: [40, 40], speed: 150, health: 100, damage: 0, knockpower: 0, ai: null, tint: 0x00ffff, projectile: null, firerate: null, target: null })
        this.player.movement = [0, 0, 0, 0];
        this.player.playercharacter = true;
        this.player.dead = false;
        this.player.depth = 1;
        this.player.mover = function () {
            this.body.setVelocity(((this.movement[0] + this.movement[1]) * this.speed)+this.knockback[0], ((this.movement[2] + this.movement[3]) * this.speed)+this.knockback[1]);
           
        }
        this.wall_holder = {
            Type1_top: { scene: this, x: 245, y: 20, size: [40, 490], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type2_top: { scene: this, x: 1035, y: 20, size: [40, 490], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type3_top: { scene: this, x: 640, y: 20, size: [40, 1280], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type1_right: { scene: this, x: 1260, y: 125, size: [250, 40], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type2_right: { scene: this, x: 1260, y: 675, size: [250, 40], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type3_right: { scene: this, x: 1260, y: 400, size: [800, 40], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type1_bottom: { scene: this, x: 245, y: 780, size: [40, 490], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type2_bottom: { scene: this, x: 1035, y: 780, size: [40, 490], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type3_bottom: { scene: this, x: 640, y: 780, size: [40, 1280], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type1_left: { scene: this, x: 20, y: 125, size: [250, 40], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type2_left: { scene: this, x: 20, y: 675, size: [250, 40], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null },
            Type3_left: { scene: this, x: 20, y: 400, size: [800, 40], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null }
        }
        this.config_holder = {
            Player: { scene: this, x: 500, y: 500, size: [40, 40], speed: 150, health: 100, damage: 0, knockpower: 0, ai: null, tint: 0x00ffff, projectile: null, firerate: null, target: null },
            Strong_Enemy: { scene: this, x: 100, y: 100, size: [60, 60], speed: 150, health: 50, damage: 20, knockpower: 1000, ai: this.ai_holder.Runner, tint: 0xaa0000, projectile: null, firerate: null, target: this.player },
            Basic_Enemy: { scene: this, x: 100, y: 200, size: [40, 40], speed: 150, health: 20, damage: 10, knockpower: 400, ai: this.ai_holder.Runner, tint: 0xaaaa00, projectile: null, firerate: null, target: this.player },
            Ranged_Enemy: { scene: this, x: 400, y: 100, size: [40, 40], speed: 50, health: 5, damage: 0, knockpower: 0, ai: this.ai_holder.Gunner, tint: 0x99dd00, projectile: "Basic", firerate: 60, target: this.player },
            Trap_Enemy: { scene: this, x: 200, y: 200, size: [20, 20], speed: 0, health: 1, damage: 5, knockpower: 500, ai: this.ai_holder.Runner, tint: 0x777777, projectile: null, firerate: null, target: this.player },
            Bat_Enemy: { scene: this, x: 400, y: 200, size: [10, 10], speed: 300, health: 10, damage: 5, knockpower: 300, ai: this.ai_holder.Chaser, tint: 0xFFFF00, projectile: null, firerate: null, target: this.player },
            Basic_Projectile: { scene: this, x: 200, y: 200, size: [10, 10], speed: 300, health: 0, damage: 5, knockpower: 500, ai: this.ai_holder.Void, tint: 0xFFAAAA, projectile: null, firerate: null, target: this.player }
        }

        this.maps = this.add.group();
        this.walls = this.physics.add.group();
        this.enemies = this.physics.add.group();
        //this.enemies.add(new being(this.config_holder.Strong_Enemy));
        //this.enemies.add(new being(this.config_holder.Basic_Enemy));
        //this.enemies.add(new being(this.config_holder.Ranged_Enemy));
        //this.enemies.add(new being(this.config_holder.Trap_Enemy));

        //Need to turn on world bounds for enemies
        //let floo = this.enemies.getChildren();
        //for (let i = 0; i < this.enemies.getChildren().length; i++) {
        //    floo[i].body.setCollideWorldBounds(true);
        //}

        this.label = this.add.text(50, 50, '(x, y)', { fontFamily: '"Monospace"' });
        this.label.depth = 1;
        this.pointer = this.input.activePointer;

        this.keys = this.input.keyboard.addKeys({
            a: Phaser.Input.Keyboard.KeyCodes.A,
            s: Phaser.Input.Keyboard.KeyCodes.S,
            d: Phaser.Input.Keyboard.KeyCodes.D,
            w: Phaser.Input.Keyboard.KeyCodes.W
        });

        this.playercalc = function () {
            if (this.keys.a.isDown) {
                this.player.movement[0] = -1;
            }
            if (this.keys.s.isDown) {
                this.player.movement[2] = 1;
            }
            if (this.keys.d.isDown) {
                this.player.movement[1] = 1;
            }
            if (this.keys.w.isDown) {
                this.player.movement[3] = -1;
            }
            if (this.keys.a.isUp) {
                this.player.movement[0] = 0;
            }
            if (this.keys.s.isUp) {
                this.player.movement[2] = 0;
            }
            if (this.keys.d.isUp) {
                this.player.movement[1] = 0;
            }
            if (this.keys.w.isUp) {
                this.player.movement[3] = 0;
            }
            
        }


        //This function is responsible for moving all entities on the screen.
        this.moverment = function () {
            //Starting with the player.
            this.player.mover();
            this.player.invincibility();
            let floo = this.enemies.getChildren();
            for (let i = 0; i < this.enemies.getChildren().length; i++) {
                floo[i].ai();
                floo[i].mover();
                floo[i].invincibility();
            }
        }

        this.physics.add.collider(this.player, this.enemies, function (dude1, dude2) {
            //Damage Swap
            dude1.hit(dude2.damage);
            dude2.hit(dude1.damage);
            //Knockback Swap
            dude1.knocker = dude2;
            dude2.knocker = dude1;
            dude1.knockcalc();
            dude2.knockcalc();
            
        });

        this.physics.add.collider(this.enemies, this.enemies, function (dude1, dude2) {
            //Damage Swap
            dude1.hit(dude2.damage);
            dude2.hit(dude1.damage);
            //Knockback Swap
            dude1.knocker = dude2;
            dude2.knocker = dude1;
            dude1.knockcalc();
            dude2.knockcalc();
            

        });

        this.physics.add.collider(this.player, this.walls);

        this.physics.add.collider(this.enemies, this.walls, function(dude1, dude2) {
            //Damage Swap
            dude1.hit(dude2.damage);
            dude2.hit(dude1.damage);
            //Knockback Swap
            dude1.knocker = dude2;
            dude2.knocker = dude1;
            dude1.knockcalc();
            dude2.knockcalc()
        });

        this.input.on('pointerdown', function (event) {
            if (this.player.dead) {
                this.scene.restart();
            }

        }, this);
        this.ded = null;
        this.YouDied = function () {
            this.player.body.setVelocity(0, 0);
            let floo = this.enemies.getChildren();
            for (let i = 0; i < this.enemies.getChildren().length; i++) {
                floo[i].body.setVelocity(0, 0);
            }
            this.ded = this.add.image(640, 400, 'YouDied');
            this.ded.displayHeight = 400;
            this.ded.displayWidth = 1280;
        }

        this.tCheck = function (room) {
            
            if (this.player.x < 0) {
                this.dx = -1280;
                this.dy = 0;
                this.direction = "left";
                this.roomPipeline(room.Connect[3], true);
                
            } else if (this.player.x > 1280) {
                this.dx = 1280;
                this.dy = 0;
                this.direction = "right";
                this.roomPipeline(room.Connect[1], true);

            } else if (this.player.y > 800) {
                this.dx = 0;
                this.dy = 800;
                this.direction = "down";
                this.roomPipeline(room.Connect[2], true);

            } else if (this.player.y < 0) {
                this.dx = 0;
                this.dy = -800;
                this.direction = "up"
                this.roomPipeline(room.Connect[0], true);

            }
        }

        this.roomPipeline = function (roomName,T) {

            if (T) {
                this.transition = false;
            } else {
                this.dx = 0;
                this.dy = 0;
            }

            let gen = this.room_holder[roomName];
            this.current_room = this.room_holder[roomName];


            this.stop_transition_time();
            this.generate_room(gen);
            

        }

        this.stop_transition_time = function () {
            this.player.body.setVelocity(0, 0);
            let floo = this.enemies.getChildren();
            for (let i = 0; i < this.enemies.getChildren().length; i++) {
                floo[i].body.setVelocity(0, 0);
            }
        }
        this.generate_room = function (room) {
            this.mgen(room.Map);
            this.bgen(room.Borders);
            this.tgen(room.Terrain);
            //this.sgen(room.Special);
            //this.lgen(room.Lock);
            this.egen(room.Enemies);
        }

        this.mgen = function (item) {
            let map = this.add.image(640+this.dx,400+this.dy,'map');
            this.maps.add(map);
        }
        this.bgen = function (list) {
            if (list[0] == 1) {
               
                
                let joe = new being(this.wall_holder.Type1_top);
                let mama = new being(this.wall_holder.Type2_top);
                
                this.walls.add(joe);
                this.walls.add(mama);
                joe.body.setImmovable(true);
                mama.body.setImmovable(true);
            } else {
                let gottem = new being(this.wall_holder.Type3_top);
                
                this.walls.add(gottem);
                gottem.body.setImmovable(true);
            }
            if (list[1] == 1) {
                let joe = new being(this.wall_holder.Type1_right);
                let mama = new being(this.wall_holder.Type2_right);
                
                this.walls.add(joe);
                this.walls.add(mama);
                joe.body.setImmovable(true);
                mama.body.setImmovable(true);
            } else {
                let gottem = new being(this.wall_holder.Type3_right);
                
                this.walls.add(gottem);
                gottem.body.setImmovable(true);
            }
            if (list[2] == 1) {
                let joe = new being(this.wall_holder.Type1_bottom);
                let mama = new being(this.wall_holder.Type2_bottom);
                
                this.walls.add(joe);
                this.walls.add(mama);
                joe.body.setImmovable(true);
                mama.body.setImmovable(true);
            } else {
                let gottem = new being(this.wall_holder.Type3_bottom);
                
                this.walls.add(gottem);
                gottem.body.setImmovable(true);
            }
            if (list[3] == 1) {
                let joe = new being(this.wall_holder.Type1_left);
                let mama = new being(this.wall_holder.Type2_left);
                
                this.walls.add(joe);
                this.walls.add(mama);
                joe.body.setImmovable(true);
                mama.body.setImmovable(true);
            } else {
                let gottem = new being(this.wall_holder.Type3_left);
                
                this.walls.add(gottem);
                gottem.body.setImmovable(true);
            }
        }
        this.tgen = function (list) {
            for (let i = 0; i < list.length; i++) {
                let ma = new being({ scene: this, x: list[i][0], y: list[i][1], size: [list[i][2], list[i][3]], speed: "wall", health: 10000, damage: 0, knockpower: 0, ai: null, tint: 0x009900, projectile: null, firerate: null, target: null });
                this.walls.add(ma);
                ma.body.setImmovable(true);
            }
            
        }
        

        this.egen = function(list){
            for (var i = 0; i < list.length; i++) {
                
                if (list[i][2] == 0) {
                    this.config_holder.Basic_Enemy.x = list[i][0];
                    this.config_holder.Basic_Enemy.y = list[i][1];
                    let tin = new being(this.config_holder.Basic_Enemy);

                    this.enemies.add(tin);
                   
                } else if (list[i][2] == 1) {
                    this.config_holder.Strong_Enemy.x = list[i][0];
                    this.config_holder.Strong_Enemy.y = list[i][1];
                    let tin = new being(this.config_holder.Strong_Enemy);

                    this.enemies.add(tin);
                    
                } else if (list[i][2] == 2) {
                    this.config_holder.Ranged_Enemy.x = list[i][0];
                    this.config_holder.Ranged_Enemy.y = list[i][1];
                    let tin = new being(this.config_holder.Ranged_Enemy);

                    this.enemies.add(tin);
                   
                } else if (list[i][2] == 3) {
                    this.config_holder.Trap_Enemy.x = list[i][0];
                    this.config_holder.Trap_Enemy.y = list[i][1];
                    let tin = new being(this.config_holder.Trap_Enemy);

                    this.enemies.add(tin);
                    
                } else if (list[i][2] == 4) {
                    this.config_holder.Bat_Enemy.x = list[i][0];
                    this.config_holder.Bat_Enemy.y = list[i][1];
                    let tin = new being(this.config_holder.Bat_Enemy);
                    tin.antiTarget = this.enemies.getChildren(); // This is used to navigate away from allies.
                    this.enemies.add(tin);
                }
            }
        }

        this.sliiiide_to_the_middle = function (speed) {
            
            if (this.direction == "up") {
                this.player.y += speed * 0.975;
            } else if (this.direction == "right") {
                this.player.x += speed * 0.975;
            } else if (this.direction == "down") {
                this.player.y -= speed * 0.975;
            } else if (this.direction == "left") {
                this.player.x -= speed * 0.975;
            }

            let move1 = this.enemies.getChildren();
            let move2 = this.walls.getChildren();
            let move3 = this.maps.getChildren();

            for (let i = 0; i < move1.length; i++) {
                if (this.direction == "up") {
                    move1[i].y += speed;
                } else if (this.direction == "right") {
                    move1[i].x += speed;
                } else if (this.direction == "down") {
                    move1[i].y -= speed;
                } else if (this.direction == "left") {
                    move1[i].x -= speed;
                }
            }
            for (let i = 0; i < move2.length; i++) {
                if (this.direction == "up") {
                    move2[i].y += speed;
                } else if (this.direction == "right") {
                    move2[i].x += speed;
                } else if (this.direction == "down") {
                    move2[i].y -= speed;
                } else if (this.direction == "left") {
                    move2[i].x -= speed;
                }
            }
            for (let i = 0; i < move3.length; i++) {
                if (this.direction == "up") {
                    move3[i].y += speed;
                } else if (this.direction == "right") {
                    move3[i].x += speed;
                } else if (this.direction == "down") {
                    move3[i].y -= speed;
                } else if (this.direction == "left") {
                    move3[i].x -= speed;
                }
            }
        }
        
        this.pizza_time = function () {
           
            this.enemies.clear(true,true);
            this.walls.clear(true, true);
            this.maps.clear(true, true);
            this.generate_room(this.current_room);
            //turn on world bounds for enemies.
            let loo = this.enemies.getChildren();
            for (let i = 0; i < loo.length; i++) {
                loo[i].body.setCollideWorldBounds(true);
            }

        }


        this.roomPipeline("Forest_1", false);
        this.current_room = this.room_holder.Forest_1;
    }

    
    function update() {
        if (this.transition) {
            if (this.player.dead == false) {
                this.label.setText(this.player.health+"\n"+this.current_room.Name+"\n"+this.enemies.getChildren().length);
                this.playercalc();
                this.moverment();
                this.tCheck(this.current_room);
            } else {
                if (this.ded == null) {
                    this.YouDied();
                }
            }
        } else {
            this.label.setText(this.dx +", " + this.dy);
            this.sliiiide_to_the_middle(4);
            if (this.direction == "up") {
                this.dy += 4;
            } else if (this.direction == "right") {
                this.dx += 4;
            } else if (this.direction == "down") {
                this.dy -= 4;
            } else if (this.direction == "left") {
                this.dx -= 4;
            }
            if (this.dx == 0 && this.dy == 0) {
                this.transition = true;
                this.pizza_time();
            }
        }
        
        
    }
</script>

movement is getting set to [NaN, NaN] somehow (probably 0 / 0) and that’s spoiling the search tree.

Excellent, after some testing it seems that somehow both my knockback and my movement was becoming corrupted to NaN whenever two entities got overlapped.
I was able to fix it just by setting the movement and knockback to simple numbers in the case of NaN.

For future reference if anyone needs how I set the checks up before setting velocity.