Skip to content

Commit

Permalink
fix portrait issues, reduce pipe delay
Browse files Browse the repository at this point in the history
  • Loading branch information
amcolash committed Aug 9, 2024
1 parent 9d7c170 commit fe27c84
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/classes/UI/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,19 @@ export class Message extends GameObjects.Container {
return;
}

const finalPortrait = portrait || (target instanceof NPC ? NPCData[(target as NPC).npcType].portrait : undefined);

this.npcName.setVisible(false);

if (!target && !portrait) {
if (!finalPortrait) {
this.portrait.setVisible(false);
this.text
.setPosition(padding, padding)
.setWordWrapWidth(padding + portraitOffset + this.textWidth, true)
.setFixedSize(padding + portraitOffset + this.textWidth, this.textHeight);
} else {
this.portrait.setVisible(true);
this.portrait.setTexture(finalPortrait);

this.text
.setPosition(padding + portraitOffset, padding + (target instanceof NPC ? nameOffset : 0))
Expand All @@ -132,8 +135,7 @@ export class Message extends GameObjects.Container {
if (target instanceof NPC) {
this.npcName.setVisible(true);
this.npcName.setText(NPCData[target.npcType].name);
this.portrait.setTexture(NPCData[target.npcType].portrait);
} else if (portrait) this.portrait.setTexture(portrait);
}
}

this.showMessage();
Expand Down
3 changes: 1 addition & 2 deletions src/scenes/Pipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ export class Pipes extends Scene {
.container()
.setPosition(Config.width / 2 - (width * this.pipeSize) / 2 + this.pipeSize / 2, Config.height / 4);

const delay = 10;

// 1st pass to initialize pipe data
for (let y = 0; y < height; y++) {
if (!this.pipes[y]) this.pipes[y] = [];
Expand Down Expand Up @@ -128,6 +126,7 @@ export class Pipes extends Scene {
}
}

const delay = 5;
const connected = getConnectedPipes(this.pipes, 0, 0);

// 2nd pass to create images with proper coloring (based on connected pipes)
Expand Down
3 changes: 2 additions & 1 deletion src/scenes/PipesDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export class PipesDialog extends Scene {
if (success) {
this.player.message.setDialog<Prop>(
{ messages: ['There. It looks like the alchemy set is properly fit back together.'] },
getProp(this.player.scene, PropType.AlchemySet)
getProp(this.player.scene, PropType.AlchemySet),
'player_portrait'
);
this.player.journal.addEntry(JournalEntry.AlchemySetFixed);
}
Expand Down

0 comments on commit fe27c84

Please sign in to comment.