Make island collision a hard stop

This commit is contained in:
Admin 2026-09-20 07:43:50 +00:00
parent 2a3627fed0
commit 37509b6f50
2 changed files with 4 additions and 3 deletions

View File

@ -206,7 +206,8 @@ class GameScene extends Phaser.Scene {
obstacle.body.setCircle(island.radius);
this.physics.add.collider(this.player, obstacle, () => {
this.playerSpeed *= 0.7;
this.playerSpeed = 0;
this.player.setVelocity(0, 0);
});
this.physics.add.collider(this.pirates, obstacle);
this.physics.add.overlap(

View File

@ -230,7 +230,7 @@ test('player propulsion smoke emits at world engine positions with per-particle
assert.doesNotMatch(source, /this\.playerSmoke\.setParticleSpeed\(/);
});
test('environment physics adds wind, island collision, turbulence, and projectile interaction', async () => {
test('environment physics adds wind, hard island collision, turbulence, and projectile interaction', async () => {
const source = await read('src/game-v4.js');
assert.match(source, /ENVIRONMENT_ISLANDS/);
@ -239,7 +239,7 @@ test('environment physics adds wind, island collision, turbulence, and projectil
assert.match(source, /this\.createEnvironmentPhysics\(\)/);
assert.match(source, /this\.physics\.add\.staticImage/);
assert.match(source, /obstacle\.body\.setCircle\(island\.radius\)/);
assert.match(source, /this\.physics\.add\.collider\(this\.player, obstacle/);
assert.match(source, /this\.physics\.add\.collider\(this\.player, obstacle, \(\) => \{[\s\S]*?this\.playerSpeed = 0;[\s\S]*?this\.player\.setVelocity\(0, 0\);/);
assert.match(source, /this\.physics\.add\.collider\(this\.pirates, obstacle\)/);
assert.match(source, /this\.physics\.add\.overlap\(\s*this\.playerShots,[\s\S]*?this\.hitEnvironmentProjectile/);
assert.match(source, /this\.environmentWind = environmentWindAt\(\{/);