Make island collision a hard stop
This commit is contained in:
parent
2a3627fed0
commit
37509b6f50
@ -206,7 +206,8 @@ class GameScene extends Phaser.Scene {
|
|||||||
obstacle.body.setCircle(island.radius);
|
obstacle.body.setCircle(island.radius);
|
||||||
|
|
||||||
this.physics.add.collider(this.player, obstacle, () => {
|
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.collider(this.pirates, obstacle);
|
||||||
this.physics.add.overlap(
|
this.physics.add.overlap(
|
||||||
|
|||||||
@ -230,7 +230,7 @@ test('player propulsion smoke emits at world engine positions with per-particle
|
|||||||
assert.doesNotMatch(source, /this\.playerSmoke\.setParticleSpeed\(/);
|
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');
|
const source = await read('src/game-v4.js');
|
||||||
|
|
||||||
assert.match(source, /ENVIRONMENT_ISLANDS/);
|
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\.createEnvironmentPhysics\(\)/);
|
||||||
assert.match(source, /this\.physics\.add\.staticImage/);
|
assert.match(source, /this\.physics\.add\.staticImage/);
|
||||||
assert.match(source, /obstacle\.body\.setCircle\(island\.radius\)/);
|
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\.collider\(this\.pirates, obstacle\)/);
|
||||||
assert.match(source, /this\.physics\.add\.overlap\(\s*this\.playerShots,[\s\S]*?this\.hitEnvironmentProjectile/);
|
assert.match(source, /this\.physics\.add\.overlap\(\s*this\.playerShots,[\s\S]*?this\.hitEnvironmentProjectile/);
|
||||||
assert.match(source, /this\.environmentWind = environmentWindAt\(\{/);
|
assert.match(source, /this\.environmentWind = environmentWindAt\(\{/);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user