diff --git a/src/game-v4.js b/src/game-v4.js index 8f25a6e..8bc2637 100644 --- a/src/game-v4.js +++ b/src/game-v4.js @@ -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( diff --git a/tests/wiring.test.mjs b/tests/wiring.test.mjs index 469c706..954ffa0 100644 --- a/tests/wiring.test.mjs +++ b/tests/wiring.test.mjs @@ -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\(\{/);