diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/config/sprites.ts | 4 | ||||
-rw-r--r-- | src/engine/entities/LambdaFactory.ts | 13 | ||||
-rw-r--r-- | src/engine/levels/Tutorial.ts | 3 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/engine/config/sprites.ts b/src/engine/config/sprites.ts index 0a4f9b5..3614488 100644 --- a/src/engine/config/sprites.ts +++ b/src/engine/config/sprites.ts @@ -110,10 +110,10 @@ const bubbleSpriteSpec = { SPRITE_SPECS.set(Sprites.BUBBLE, bubbleSpriteSpec); const portalSpriteSpec = { - msPerFrame: 200, + msPerFrame: 150, width: 64, height: 64, - frames: 3, + frames: 9, sheet: "/assets/portal.png", }; SPRITE_SPECS.set(Sprites.PORTAL, portalSpriteSpec); diff --git a/src/engine/entities/LambdaFactory.ts b/src/engine/entities/LambdaFactory.ts index 9ad1398..770c096 100644 --- a/src/engine/entities/LambdaFactory.ts +++ b/src/engine/entities/LambdaFactory.ts @@ -143,12 +143,19 @@ export class LambdaFactory extends Entity { } private spawnNewLambda(direction: Direction) { + try { + parse(this.code); + } catch (e: any) { + SOUNDS.get(Failure.name)!.play(); + return; + } + const spawner = this.getComponent<GridSpawn>(ComponentNames.GridSpawn); spawner.spawnEntity(direction); - const text = this.getComponent<Text>(ComponentNames.Text); - text.text = spawner.spawnsLeft.toString(); - this.addComponent(text); + const textComponent = this.getComponent<Text>(ComponentNames.Text); + textComponent.text = spawner.spawnsLeft.toString(); + this.addComponent(textComponent); SOUNDS.get(LambdaTransformSound.name)!.play(); } diff --git a/src/engine/levels/Tutorial.ts b/src/engine/levels/Tutorial.ts index 165b10f..694c8ff 100644 --- a/src/engine/levels/Tutorial.ts +++ b/src/engine/levels/Tutorial.ts @@ -22,8 +22,7 @@ export class Tutorial extends Level { new Wall({ x: 11, y: 10 }), new Curry({ x: 10, y: 10 }), new LockedDoor({ x: 9, y: 10 }), - new LambdaFactory({ x: 6, y: 3 }, "(λ (x) . x)", 3), - + new LambdaFactory({ x: 6, y: 3 }, "// TODO: Remove line\n(λ (x) . x)", 3), new FunctionApplication({ x: 6, y: 6 }, "(_INPUT key)"), ]; |