如何破坏 2 个对象 Phaser 3 之间的重叠

问题描述 投票:0回答:0

我正在开发一款游戏,我在其中添加了 2 个对象之间的重叠,但在它们之间进行了某个操作之后,我想破坏重叠。我想不通。任何帮助表示赞赏。

Update function

 function checkOverlap(postava, rozcestnik) {
            var boundsA = postava.getBounds();
            var boundsB = rozcestnik.getBounds();
            return Phaser.Geom.Intersects.RectangleToRectangle(boundsA, boundsB);
        }


        if(this.keys.E.isDown && checkOverlap(this.postava, this.rozcestnik) == true)
        {

         this.colliderRozcestnik = this.physics.add.overlap(this.postava, this.rozcestnik, diaOknoRozcestnik.bind(this), null, this)

         this.physics.world.removeCollider(this.colliderRozcestnik);
         
        }


        function diaOknoRozcestnik(postava, rozcestnik)
        {
        postava.anims.play("left");
        this.gzDialog.visible;
        this.gzDialog.setText("I need to find some car mechanic to repair the engine.");
        }
javascript collision phaser-framework overlap
© www.soinside.com 2019 - 2024. All rights reserved.