diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 02:22:46 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 02:24:18 -0700 |
commit | 06bb4177202b432d5f42141975ec82b5a8837f0e (patch) | |
tree | 7a9cb1e4177684848a3fcca91eed2ec703c787fb /src/engine/systems/Render.ts | |
parent | cd6a3a56b0a9f27dd7250c7641776fe1bd184888 (diff) | |
download | the-abstraction-engine-06bb4177202b432d5f42141975ec82b5a8837f0e.tar.gz the-abstraction-engine-06bb4177202b432d5f42141975ec82b5a8837f0e.zip |
slight refactor in collision behavior
Diffstat (limited to 'src/engine/systems/Render.ts')
-rw-r--r-- | src/engine/systems/Render.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/engine/systems/Render.ts b/src/engine/systems/Render.ts index 7cb5d81..83daa52 100644 --- a/src/engine/systems/Render.ts +++ b/src/engine/systems/Render.ts @@ -1,5 +1,5 @@ import { System, SystemNames } from "."; -import { BoundingBox, ComponentNames, Sprite } from "../components"; +import { BoundingBox, ComponentNames, Highlight, Sprite } from "../components"; import { Game } from ".."; import { clamp } from "../utils"; import { DrawArgs } from "../interfaces"; @@ -43,8 +43,13 @@ export class Render extends System { center: boundingBox.center, dimension: boundingBox.dimension, rotation: boundingBox.rotation, - tint: entity.hasComponent(ComponentNames.Highlight) ? "red" : undefined, }; + if (entity.hasComponent(ComponentNames.Highlight)) { + const highlight = entity.getComponent<Highlight>( + ComponentNames.Highlight, + ); + drawArgs.tint = highlight.isHighlighted ? "red" : undefined; + } sprite.draw(this.ctx, drawArgs); }); |