diff --git a/src/game-v4.js b/src/game-v4.js index 8bc2637..8f25a6e 100644 --- a/src/game-v4.js +++ b/src/game-v4.js @@ -206,8 +206,7 @@ class GameScene extends Phaser.Scene { obstacle.body.setCircle(island.radius); this.physics.add.collider(this.player, obstacle, () => { - this.playerSpeed = 0; - this.player.setVelocity(0, 0); + this.playerSpeed *= 0.7; }); this.physics.add.collider(this.pirates, obstacle); this.physics.add.overlap( diff --git a/tests/wiring.test.mjs b/tests/wiring.test.mjs index 954ffa0..aa8765e 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, hard island collision, turbulence, and projectile interaction', async () => { +test('environment physics adds wind, soft 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, hard island collision, turbulence, and proj 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, \(\) => \{[\s\S]*?this\.playerSpeed = 0;[\s\S]*?this\.player\.setVelocity\(0, 0\);/); + assert.match(source, /this\.physics\.add\.collider\(this\.player, obstacle, \(\) => \{[\s\S]*?this\.playerSpeed \*= 0\.7;/); 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\(\{/);