How to make physics object keep moving while on collision/collider?

I want to make enemys keep moving on the track while on collision with bullets

Here is the live preview http://cdn.redfoc.com/test/ship

code

	    let enemys = this.physics.add.sprite(360,0,'enemy');
    enemys.enemy = true;
	enemys.setCollideWorldBounds(true);
	enemys.setBounce(1,1);
	//enemys.body.onWorldBounds = true;
    var angle = BetweenPoints(enemys, {x: 100, y: 700});
	velocityFromRotation(angle, 100, velocity);
    enemys.setVelocity(Phaser.Math.Between(100, 150), Phaser.Math.Between(100, 120));

    let bullets = this.physics.add.group({
        classType: Bullet,
        runChildUpdate: true
    });

Collider

this.physics.add.collider(enemys, bullet, collision);

How to fix this?

Thanks

this.physics.add.overlap(enemys, bullet, collision);
1 Like

Thank you! it’s a bit confused when the result actually different.