diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 05:30:17 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 05:30:17 -0700 |
commit | cbb88091bdf69cc8752ef1cc3662dc0b99e3ead6 (patch) | |
tree | b10e56d8f5281a9e91db8e2a923f91b216129459 /src/engine/entities/Curry.ts | |
parent | 4b9349b3f8bee21eb086cfd6e7668532a50e6048 (diff) | |
download | the-abstraction-engine-cbb88091bdf69cc8752ef1cc3662dc0b99e3ead6.tar.gz the-abstraction-engine-cbb88091bdf69cc8752ef1cc3662dc0b99e3ead6.zip |
key lock / player curry collisions
Diffstat (limited to 'src/engine/entities/Curry.ts')
-rw-r--r-- | src/engine/entities/Curry.ts | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/engine/entities/Curry.ts b/src/engine/entities/Curry.ts new file mode 100644 index 0000000..85bc7ef --- /dev/null +++ b/src/engine/entities/Curry.ts @@ -0,0 +1,45 @@ +import { Entity, EntityNames } from "."; +import { BoundingBox, Colliding, Grid, Sprite } from "../components"; +import { IMAGES, SPRITE_SPECS, SpriteSpec, Sprites } from "../config"; +import { Coord2D } from "../interfaces"; + +export class Curry extends Entity { + private static spriteSpec: SpriteSpec = SPRITE_SPECS.get( + Sprites.CURRY, + ) as SpriteSpec; + + constructor(gridPosition: Coord2D) { + super(EntityNames.Curry); + + this.addComponent(new Grid(gridPosition)); + + this.addComponent(new Colliding()); + + this.addComponent( + new BoundingBox( + { + x: 0, + y: 0, + }, + { + width: Curry.spriteSpec.width, + height: Curry.spriteSpec.height, + }, + 0, + ), + ); + + this.addComponent( + new Sprite( + IMAGES.get(Curry.spriteSpec.sheet)!, + { x: 0, y: 0 }, + { + width: Curry.spriteSpec.width, + height: Curry.spriteSpec.height, + }, + Curry.spriteSpec.msPerFrame, + Curry.spriteSpec.frames, + ), + ); + } +} |