summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-07 23:48:04 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-07 23:48:04 -0700
commit634b2c1b69b9cc107546b12e710fc2daec53fcec (patch)
tree27b3396a227ace81fea583c62fbb36458cb1eebe /src/engine
parentea6c1eef48ba8d39defdd8cd78adc45ae660caf9 (diff)
downloadthe-abstraction-engine-634b2c1b69b9cc107546b12e710fc2daec53fcec.tar.gz
the-abstraction-engine-634b2c1b69b9cc107546b12e710fc2daec53fcec.zip
minor bug fixes
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/config/sprites.ts4
-rw-r--r--src/engine/entities/LambdaFactory.ts13
-rw-r--r--src/engine/levels/Tutorial.ts3
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)"),
];