summaryrefslogtreecommitdiff
path: root/src/engine/entities
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-11 16:35:51 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-11 16:35:51 -0600
commitde4f3fd2fe45478ffabc84f055592e11b119d0a4 (patch)
treead2ce3b3e646d2d6bfbccb4b9c8962196a0ea8fe /src/engine/entities
parent32879581e53fae5e684c24b44433172d8375d69e (diff)
downloadthe-abstraction-engine-de4f3fd2fe45478ffabc84f055592e11b119d0a4.tar.gz
the-abstraction-engine-de4f3fd2fe45478ffabc84f055592e11b119d0a4.zip
prettier, fix assets and css
Diffstat (limited to 'src/engine/entities')
-rw-r--r--src/engine/entities/Curry.ts10
-rw-r--r--src/engine/entities/FunctionApplication.ts18
-rw-r--r--src/engine/entities/FunctionBox.ts14
-rw-r--r--src/engine/entities/Grass.ts4
-rw-r--r--src/engine/entities/Key.ts10
-rw-r--r--src/engine/entities/LambdaFactory.ts22
-rw-r--r--src/engine/entities/LockedDoor.ts10
-rw-r--r--src/engine/entities/Particles.ts16
-rw-r--r--src/engine/entities/Player.ts10
-rw-r--r--src/engine/entities/Portal.ts8
-rw-r--r--src/engine/entities/Sign.ts10
-rw-r--r--src/engine/entities/Wall.ts10
12 files changed, 71 insertions, 71 deletions
diff --git a/src/engine/entities/Curry.ts b/src/engine/entities/Curry.ts
index 583b9b8..19c5b91 100644
--- a/src/engine/entities/Curry.ts
+++ b/src/engine/entities/Curry.ts
@@ -8,7 +8,7 @@ import { Level, SystemNames } from "../systems";
export class Curry extends Entity {
private static spriteSpec: SpriteSpec = SPRITE_SPECS.get(
- Sprites.CURRY
+ Sprites.CURRY,
) as SpriteSpec;
constructor(gridPosition: Coord2D) {
@@ -28,8 +28,8 @@ export class Curry extends Entity {
width: Curry.spriteSpec.width,
height: Curry.spriteSpec.height,
},
- 0
- )
+ 0,
+ ),
);
this.addComponent(
@@ -41,8 +41,8 @@ export class Curry extends Entity {
height: Curry.spriteSpec.height,
},
Curry.spriteSpec.msPerFrame,
- Curry.spriteSpec.frames
- )
+ Curry.spriteSpec.frames,
+ ),
);
}
diff --git a/src/engine/entities/FunctionApplication.ts b/src/engine/entities/FunctionApplication.ts
index 175534c..a266941 100644
--- a/src/engine/entities/FunctionApplication.ts
+++ b/src/engine/entities/FunctionApplication.ts
@@ -62,8 +62,8 @@ export class FunctionApplication extends Entity {
y: 0,
},
dimension,
- 0
- )
+ 0,
+ ),
);
this.addComponent(new Grid(gridPosition));
@@ -76,8 +76,8 @@ export class FunctionApplication extends Entity {
{ x: 0, y: 0 },
dimension,
FunctionApplication.spriteSpec.msPerFrame,
- FunctionApplication.spriteSpec.frames
- )
+ FunctionApplication.spriteSpec.frames,
+ ),
);
this.addComponent(new Colliding(this.handleCollision.bind(this)));
@@ -100,7 +100,7 @@ export class FunctionApplication extends Entity {
const gridSystem = game.getSystem<GridSystem>(SystemNames.Grid);
const fail = () => {
entityGrid.movingDirection = gridSystem.oppositeDirection(
- entityGrid.previousDirection
+ entityGrid.previousDirection,
);
entity.addComponent(entityGrid);
@@ -109,10 +109,10 @@ export class FunctionApplication extends Entity {
};
const applicationTerm = this.getComponent<LambdaTerm>(
- ComponentNames.LambdaTerm
+ ComponentNames.LambdaTerm,
);
const functionTerm = entity.getComponent<LambdaTerm>(
- ComponentNames.LambdaTerm
+ ComponentNames.LambdaTerm,
);
const newCode = applicationTerm.code.replace("_INPUT", functionTerm.code);
@@ -128,7 +128,7 @@ export class FunctionApplication extends Entity {
const { dimension } = gridSystem;
const nextPosition = gridSystem.getNewGridPosition(
grid.gridPosition,
- entityGrid.previousDirection
+ entityGrid.previousDirection,
);
let applicationResultingEntity: Entity | null = null; // this should be its own function
@@ -150,7 +150,7 @@ export class FunctionApplication extends Entity {
game.removeEntity(entity.id);
if (applicationResultingEntity) {
const grid = applicationResultingEntity.getComponent<Grid>(
- ComponentNames.Grid
+ ComponentNames.Grid,
);
grid.movingDirection = entityGrid.previousDirection;
applicationResultingEntity.addComponent(grid);
diff --git a/src/engine/entities/FunctionBox.ts b/src/engine/entities/FunctionBox.ts
index 7b70567..4878c98 100644
--- a/src/engine/entities/FunctionBox.ts
+++ b/src/engine/entities/FunctionBox.ts
@@ -24,7 +24,7 @@ import { openModal, closeModal } from "../utils";
export class FunctionBox extends Entity {
private static spriteSpec: SpriteSpec = SPRITE_SPECS.get(
- Sprites.FUNCTION_BOX
+ Sprites.FUNCTION_BOX,
) as SpriteSpec;
constructor(gridPosition: Coord2D, code: string) {
@@ -40,8 +40,8 @@ export class FunctionBox extends Entity {
width: FunctionBox.spriteSpec.width,
height: FunctionBox.spriteSpec.height,
},
- 0
- )
+ 0,
+ ),
);
this.addComponent(new Pushable());
@@ -57,8 +57,8 @@ export class FunctionBox extends Entity {
height: FunctionBox.spriteSpec.height,
},
FunctionBox.spriteSpec.msPerFrame,
- FunctionBox.spriteSpec.frames
- )
+ FunctionBox.spriteSpec.frames,
+ ),
);
this.addComponent(new LambdaTerm(code));
@@ -69,7 +69,7 @@ export class FunctionBox extends Entity {
export const makeLambdaTermHighlightComponent = (
entity: Entity,
- text?: string
+ text?: string,
) => {
const onUnhighlight = () => {
closeModal();
@@ -94,7 +94,7 @@ export const makeLambdaTermHighlightComponent = (
text ??
entity.getComponent<LambdaTerm>(ComponentNames.LambdaTerm)!.code;
openModal(
- `<div style="text-align:center"><p>${code}</p> <br> <button id="close">Close</button></div>`
+ `<div style="text-align:center"><p>${code}</p> <br> <button id="close">Close</button></div>`,
);
modalOpen = true;
SOUNDS.get(ModalOpen.name)!.play();
diff --git a/src/engine/entities/Grass.ts b/src/engine/entities/Grass.ts
index 4fdf1bc..70fd601 100644
--- a/src/engine/entities/Grass.ts
+++ b/src/engine/entities/Grass.ts
@@ -20,8 +20,8 @@ export class Grass extends Entity {
height: Grass.spriteSpec.height,
},
Grass.spriteSpec.msPerFrame,
- Grass.spriteSpec.frames
- )
+ Grass.spriteSpec.frames,
+ ),
);
}
}
diff --git a/src/engine/entities/Key.ts b/src/engine/entities/Key.ts
index ec86d0a..7168ee8 100644
--- a/src/engine/entities/Key.ts
+++ b/src/engine/entities/Key.ts
@@ -5,7 +5,7 @@ import { Coord2D } from "../interfaces";
export class Key extends Entity {
private static spriteSpec: SpriteSpec = SPRITE_SPECS.get(
- Sprites.KEY
+ Sprites.KEY,
) as SpriteSpec;
constructor(gridPosition: Coord2D) {
@@ -25,8 +25,8 @@ export class Key extends Entity {
width: Key.spriteSpec.width,
height: Key.spriteSpec.height,
},
- 0
- )
+ 0,
+ ),
);
this.addComponent(
@@ -38,8 +38,8 @@ export class Key extends Entity {
height: Key.spriteSpec.height,
},
Key.spriteSpec.msPerFrame,
- Key.spriteSpec.frames
- )
+ Key.spriteSpec.frames,
+ ),
);
}
}
diff --git a/src/engine/entities/LambdaFactory.ts b/src/engine/entities/LambdaFactory.ts
index 6f75e90..770c096 100644
--- a/src/engine/entities/LambdaFactory.ts
+++ b/src/engine/entities/LambdaFactory.ts
@@ -75,7 +75,7 @@ const syntaxErrorDecoration = Decoration.mark({
export class LambdaFactory extends Entity {
private static spriteSpec: SpriteSpec = SPRITE_SPECS.get(
- Sprites.LAMBDA_FACTORY
+ Sprites.LAMBDA_FACTORY,
) as SpriteSpec;
private codeEditorState: CodeEditorState | null;
@@ -99,8 +99,8 @@ export class LambdaFactory extends Entity {
width: LambdaFactory.spriteSpec.width,
height: LambdaFactory.spriteSpec.height,
},
- 0
- )
+ 0,
+ ),
);
this.addComponent(new Text(spawns.toString()));
@@ -110,8 +110,8 @@ export class LambdaFactory extends Entity {
this.addComponent(
new GridSpawn(
this.spawns,
- () => new FunctionBox({ x: 0, y: 0 }, this.code)
- )
+ () => new FunctionBox({ x: 0, y: 0 }, this.code),
+ ),
);
this.addComponent(new Grid(gridPosition));
@@ -125,15 +125,15 @@ export class LambdaFactory extends Entity {
height: LambdaFactory.spriteSpec.height,
},
LambdaFactory.spriteSpec.msPerFrame,
- LambdaFactory.spriteSpec.frames
- )
+ LambdaFactory.spriteSpec.frames,
+ ),
);
this.addComponent(
new Highlight(
(direction) => this.onHighlight(direction),
- () => this.onUnhighlight()
- )
+ () => this.onUnhighlight(),
+ ),
);
}
@@ -179,10 +179,10 @@ export class LambdaFactory extends Entity {
const codeBox = document.getElementById("code")!;
const syntaxError = document.getElementById("syntax-error")!;
const canvas = document.getElementById(
- Miscellaneous.CANVAS_ID
+ Miscellaneous.CANVAS_ID,
) as HTMLCanvasElement;
const closeButton = document.getElementById(
- "close-modal"
+ "close-modal",
) as HTMLButtonElement;
closeButton.addEventListener("click", () => this.saveAndCloseCodeEditor());
diff --git a/src/engine/entities/LockedDoor.ts b/src/engine/entities/LockedDoor.ts
index 3d1fbbe..aa1f328 100644
--- a/src/engine/entities/LockedDoor.ts
+++ b/src/engine/entities/LockedDoor.ts
@@ -21,7 +21,7 @@ import { colors } from "../utils";
export class LockedDoor extends Entity {
private static spriteSpec: SpriteSpec = SPRITE_SPECS.get(
- Sprites.LOCKED_DOOR
+ Sprites.LOCKED_DOOR,
) as SpriteSpec;
constructor(gridPosition: Coord2D) {
@@ -41,8 +41,8 @@ export class LockedDoor extends Entity {
width: LockedDoor.spriteSpec.width,
height: LockedDoor.spriteSpec.height,
},
- 0
- )
+ 0,
+ ),
);
this.addComponent(
@@ -54,8 +54,8 @@ export class LockedDoor extends Entity {
height: LockedDoor.spriteSpec.height,
},
LockedDoor.spriteSpec.msPerFrame,
- LockedDoor.spriteSpec.frames
- )
+ LockedDoor.spriteSpec.frames,
+ ),
);
}
diff --git a/src/engine/entities/Particles.ts b/src/engine/entities/Particles.ts
index d2d4dbb..5381b23 100644
--- a/src/engine/entities/Particles.ts
+++ b/src/engine/entities/Particles.ts
@@ -86,7 +86,7 @@ class ParticleRenderer extends Component implements Renderable {
particle.dimension.height / 2,
0,
0,
- Math.PI * 2
+ Math.PI * 2,
);
ctx.fill();
} else {
@@ -94,7 +94,7 @@ class ParticleRenderer extends Component implements Renderable {
particle.position.x - particle.dimension.width / 2,
particle.position.y - particle.dimension.height / 2,
particle.dimension.width,
- particle.dimension.height
+ particle.dimension.height,
);
}
}
@@ -119,7 +119,7 @@ export class Particles extends Entity {
const life = this.getComponent<Life>(ComponentNames.Life);
life.alive = false;
this.addComponent(life);
- })
+ }),
);
this.addComponent(
@@ -132,8 +132,8 @@ export class Particles extends Entity {
width: spawnOptions.spawnerDimensions.width,
height: spawnOptions.spawnerDimensions.height,
},
- 0
- )
+ 0,
+ ),
);
}
@@ -141,15 +141,15 @@ export class Particles extends Entity {
const angle = Math.random() * Math.PI * 2;
const speed = normalRandom(
options.particleMeanSpeed,
- options.particleSpeedVariance
+ options.particleSpeedVariance,
);
const life = normalRandom(
options.particleMeanLife,
- options.particleLifeVariance
+ options.particleLifeVariance,
);
const size = normalRandom(
options.particleMeanSize,
- options.particleSizeVariance
+ options.particleSizeVariance,
);
const color =
options.particleColors[
diff --git a/src/engine/entities/Player.ts b/src/engine/entities/Player.ts
index ec88a90..9e2e1cb 100644
--- a/src/engine/entities/Player.ts
+++ b/src/engine/entities/Player.ts
@@ -12,7 +12,7 @@ import { Coord2D, Direction } from "../interfaces/";
export class Player extends Entity {
private static spriteSpec: SpriteSpec = SPRITE_SPECS.get(
- Sprites.PLAYER
+ Sprites.PLAYER,
) as SpriteSpec;
constructor(gridPosition: Coord2D) {
@@ -25,8 +25,8 @@ export class Player extends Entity {
y: 0,
},
{ width: Player.spriteSpec.width, height: Player.spriteSpec.height },
- 0
- )
+ 0,
+ ),
);
this.addComponent(new Pushable());
@@ -51,14 +51,14 @@ export class Player extends Entity {
{ x: 0, y: 0 },
{ width: Player.spriteSpec.width, height: Player.spriteSpec.height },
Player.spriteSpec.msPerFrame,
- Player.spriteSpec.frames
+ Player.spriteSpec.frames,
);
facingDirectionComponent.directionSprites.set(direction, sprite);
});
this.addComponent(facingDirectionComponent);
this.addComponent(
- facingDirectionComponent.directionSprites.get(Direction.NONE)!
+ facingDirectionComponent.directionSprites.get(Direction.NONE)!,
); // face no direction by default
}
}
diff --git a/src/engine/entities/Portal.ts b/src/engine/entities/Portal.ts
index 221004c..a747aa9 100644
--- a/src/engine/entities/Portal.ts
+++ b/src/engine/entities/Portal.ts
@@ -25,8 +25,8 @@ export class Portal extends Entity {
width: Portal.spriteSpec.width,
height: Portal.spriteSpec.height,
},
- 0
- )
+ 0,
+ ),
);
this.addComponent(
@@ -38,8 +38,8 @@ export class Portal extends Entity {
height: Portal.spriteSpec.height,
},
Portal.spriteSpec.msPerFrame,
- Portal.spriteSpec.frames
- )
+ Portal.spriteSpec.frames,
+ ),
);
this.addComponent(new Colliding(this.handleCollision.bind(this)));
diff --git a/src/engine/entities/Sign.ts b/src/engine/entities/Sign.ts
index a11fba6..45f2986 100644
--- a/src/engine/entities/Sign.ts
+++ b/src/engine/entities/Sign.ts
@@ -5,7 +5,7 @@ import { Coord2D } from "../interfaces";
export class Sign extends Entity {
private static spriteSpec: SpriteSpec = SPRITE_SPECS.get(
- Sprites.SIGN
+ Sprites.SIGN,
) as SpriteSpec;
private text: string;
@@ -25,8 +25,8 @@ export class Sign extends Entity {
{ x: 0, y: 0 },
dimension,
Sign.spriteSpec.msPerFrame,
- Sign.spriteSpec.frames
- )
+ Sign.spriteSpec.frames,
+ ),
);
this.addComponent(
@@ -36,8 +36,8 @@ export class Sign extends Entity {
y: 0,
},
dimension,
- 0
- )
+ 0,
+ ),
);
this.addComponent(new Grid(gridPosition));
diff --git a/src/engine/entities/Wall.ts b/src/engine/entities/Wall.ts
index f5beb9c..621a569 100644
--- a/src/engine/entities/Wall.ts
+++ b/src/engine/entities/Wall.ts
@@ -5,7 +5,7 @@ import { Coord2D } from "../interfaces";
export class Wall extends Entity {
private static spriteSpec: SpriteSpec = SPRITE_SPECS.get(
- Sprites.WALL
+ Sprites.WALL,
) as SpriteSpec;
constructor(gridPosition: Coord2D) {
@@ -25,8 +25,8 @@ export class Wall extends Entity {
width: Wall.spriteSpec.width,
height: Wall.spriteSpec.height,
},
- 0
- )
+ 0,
+ ),
);
this.addComponent(
@@ -38,8 +38,8 @@ export class Wall extends Entity {
height: Wall.spriteSpec.height,
},
Wall.spriteSpec.msPerFrame,
- Wall.spriteSpec.frames
- )
+ Wall.spriteSpec.frames,
+ ),
);
}
}