Skip to content

Commit 9dc2d28

Browse files
committed
Add BMFTR Logo
1 parent fa0140c commit 9dc2d28

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

src/Game.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { Application, Assets } from "pixi.js";
1+
import { Application } from "pixi.js";
22
import Menu from "./nodes/Menu";
33
import { HEIGHT, WIDTH } from "./constants";
44
import SinglePlayer from "./nodes/SinglePlayer";
55
import Multiplayer from "./nodes/Multiplayer";
66
import Background from "./nodes/Background";
77
import { initSounds } from "./audio";
88
import { inputs } from "./inputs";
9-
import ministryLogoPath from "./assets/img/ministry-logo.png";
109
import IdleMode from "./nodes/IdleMode";
1110
import { randomInt } from "mathjs";
1211
import { campaign } from "./levels";
@@ -27,8 +26,6 @@ export default class Game {
2726
height: HEIGHT,
2827
});
2928

30-
const ministryLogoTexture = await Assets.load(ministryLogoPath);
31-
3229
// Append the application canvas to the document body
3330
document.getElementById("app")!.appendChild(app.canvas);
3431

@@ -105,6 +102,7 @@ export default class Game {
105102
clearTimeout(timeout);
106103
menu.hide();
107104
const credits = new Credits();
105+
credits.load();
108106
app.stage.addChild(credits.view);
109107
credits.onFinish = () => {
110108
app.stage.removeChild(credits.view);

src/nodes/Credits.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Point, Container, Graphics, HTMLText } from "pixi.js";
1+
import { Point, Container, Graphics, HTMLText, Assets, Sprite } from "pixi.js";
22
import { HEIGHT, TEXT_FONT, theme, WIDTH } from "../constants";
33
import { container } from "../util";
44
import GameNode from "./GameNode";
5+
import ministryLogoPath from "../assets/img/ministry-logo.png";
56

67
export default class Credits extends GameNode {
78
onFinish?: () => void;
@@ -60,7 +61,7 @@ export default class Credits extends GameNode {
6061
"Oliver Schön"
6162
);
6263
this.drawCredit(
63-
new Point(width, -HEIGHT * 0.15),
64+
new Point(width, -HEIGHT * 0.125),
6465
"Arcade Machine Graphic Design",
6566
"Eric Londaits"
6667
);
@@ -69,7 +70,7 @@ export default class Credits extends GameNode {
6970
"Arcade Machine Building",
7071
"Retr-O-Mat"
7172
);
72-
this.drawCredit(new Point(0, HEIGHT * 0.1), "Funded by", "BMFTR");
73+
// this.drawCredit(new Point(0, HEIGHT * 0.1), "Funded by", "BMFTR");
7374
}
7475

7576
drawCredit(position: Point, title: string, ...names: string[]) {
@@ -110,4 +111,28 @@ export default class Credits extends GameNode {
110111
document.removeEventListener("keydown", this.handleKeyDown);
111112
this.onFinish?.();
112113
};
114+
115+
async load() {
116+
const fundedBy = new Container();
117+
fundedBy.position = { x: -WIDTH * 0.2, y: HEIGHT * 0.2 };
118+
const ministryLogoTexture = await Assets.load(ministryLogoPath);
119+
const titleText = new HTMLText({
120+
text: "Funded by",
121+
style: {
122+
align: "center",
123+
fill: theme.colors.primary,
124+
fontFamily: TEXT_FONT,
125+
fontWeight: "bold",
126+
fontSize: 40,
127+
},
128+
});
129+
titleText.anchor = { x: 0.5, y: 0 };
130+
fundedBy.addChild(titleText);
131+
const sprite = new Sprite(ministryLogoTexture);
132+
sprite.anchor = { x: 0.5, y: 0 };
133+
sprite.position.y = 50;
134+
sprite.scale = 0.3;
135+
fundedBy.addChild(sprite);
136+
this.view.addChild(fundedBy);
137+
}
113138
}

0 commit comments

Comments
 (0)