Skip to content

Commit

Permalink
Update engine.js
Browse files Browse the repository at this point in the history
  • Loading branch information
leomcelroy committed Jul 20, 2022
1 parent 000754a commit 286887b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions engine/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function init({ palette, setBitmaps, setScreenSize, drawText }) {
solids: [],
pushable: {},
};
drawText(state.text);
if (drawText) drawText(state.text);

class Sprite {
constructor(type, x, y) {
Expand Down Expand Up @@ -152,6 +152,9 @@ export function init({ palette, setBitmaps, setScreenSize, drawText }) {
}

function setLegend(...bitmaps) {
bitmaps.forEach(([ key, value ]) => {
if (key.length !== 1) throw new Error(`Bitmaps must have one character names.`);
})
state.legend = bitmaps;
setBitmaps(bitmaps);
}
Expand Down Expand Up @@ -192,7 +195,7 @@ export function init({ palette, setBitmaps, setScreenSize, drawText }) {

function setTextColor(r, g, b) {
state.textColor = [r, g, b];
drawText(state.text);
if (drawText) drawText(state.text);
}

function setText(str) {
Expand Down

0 comments on commit 286887b

Please sign in to comment.