Skip to content

Commit 4b89abc

Browse files
committed
Add ministry logo.
1 parent 630072d commit 4b89abc

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/Game.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { Application } from "pixi.js";
1+
import { Application, Assets } 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";
910

1011
export default class Game {
1112
async start() {
@@ -20,6 +21,8 @@ export default class Game {
2021
height: HEIGHT,
2122
});
2223

24+
const ministryLogoTexture = await Assets.load(ministryLogoPath);
25+
2326
// Append the application canvas to the document body
2427
document.getElementById("app")!.appendChild(app.canvas);
2528

@@ -32,7 +35,7 @@ export default class Game {
3235

3336
const background = new Background();
3437

35-
const menu = new Menu(background);
38+
const menu = new Menu(background, ministryLogoTexture);
3639
app.stage.addChild(background.view);
3740
app.ticker.add(background.tick);
3841
menu.show(app.stage);

src/assets/img/ministry-logo.png

33.3 KB
Loading

src/nodes/Menu.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Container, Graphics, HTMLText } from "pixi.js";
1+
import { Container, Graphics, HTMLText, Sprite } from "pixi.js";
22
import { HEIGHT, TEXT_FONT, theme, WIDTH } from "../constants";
33
import GameNode from "./GameNode";
44
import { inputs } from "../inputs";
@@ -22,14 +22,14 @@ export default class Menu extends GameNode {
2222
levelSelect = new Container();
2323
background: Background;
2424

25-
constructor(background: Background) {
25+
constructor(background: Background, ministryLogo: any) {
2626
super();
2727
this.background = background;
2828
this.view.position.x = WIDTH / 2;
2929
this.view.position.y = HEIGHT / 2;
3030

3131
const boxHeight = 900;
32-
const boxWidth = 1500;
32+
const boxWidth = 1400;
3333
this.view.addChild(
3434
container(
3535
new Graphics().roundRect(
@@ -105,6 +105,12 @@ export default class Menu extends GameNode {
105105
.fill(theme.colors.primary);
106106
this.levelSelect.addChild(leftArrow);
107107
this.levelSelect.addChild(rightArrow);
108+
109+
const logo = new Sprite(ministryLogo);
110+
logo.anchor = { x: 0, y: 1 };
111+
logo.position = { x: -WIDTH / 2, y: HEIGHT / 2 };
112+
logo.scale = 0.3;
113+
this.view.addChild(logo);
108114
}
109115

110116
toggleNumPlayers() {

0 commit comments

Comments
 (0)