minor bug fixes

This commit is contained in:
Elizabeth Hunt 2024-03-07 23:48:04 -07:00
parent ea6c1eef48
commit 634b2c1b69
Signed by: simponic
GPG Key ID: 52B3774857EB24B1
6 changed files with 17 additions and 15 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -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);

View File

@ -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();
}

View File

@ -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)"),
];

View File

@ -201,7 +201,7 @@ export default (function () {
);
};
function peg$parse(input, options, allowUnderscores = false) {
function peg$parse(input, options) {
options = options !== undefined ? options : {};
var peg$FAILED = {};
@ -215,7 +215,7 @@ export default (function () {
var peg$c2 = ".";
var peg$c3 = "\r\n";
var peg$r0 = allowUnderscores ? /^[a-zA-Z0-9]_/ : /^[a-zA-Z0-9]/;
var peg$r0 = /^[a-zA-Z0-9]/;
var peg$r1 = /^[\\\u03BB]/;
var peg$r2 = /^[\t-\n ]/;

View File

@ -30,10 +30,6 @@ export const isVariable = (term: LambdaTerm): term is Variable => {
return typeof term === "string";
};
export const parse = (
term: string,
allowUnderscores = false,
library = false,
) => {
return peggyParser.parse(term, { peg$library: library }, allowUnderscores);
export const parse = (term: string, library = false) => {
return peggyParser.parse(term, { peg$library: library });
};