change to bitmap text

This commit is contained in:
Mashy 2019-03-05 14:52:59 +10:00
parent 5fa964c382
commit 99d0231a9c
9 changed files with 21 additions and 19 deletions

View File

@ -112,7 +112,7 @@ class Combat extends Phaser.Scene {
bText: 'Leave Game', bText: 'Leave Game',
callback: leaveGame, callback: leaveGame,
}; };
this.box = this.add.existing(new Button(this, buttonProps)); // this.box = this.add.existing(new Button(this, buttonProps));
} }
cleanUp() { cleanUp() {

View File

@ -9,7 +9,7 @@ const Combat = require('./combat');
function renderCryps() { function renderCryps() {
const config = { const config = {
type: Phaser.AUTO, type: Phaser.CANVAS,
// backgroundColor: '#181818', // backgroundColor: '#181818',
resolution: window.devicePixelRatio, resolution: window.devicePixelRatio,
scale: { scale: {

View File

@ -17,10 +17,12 @@ class Header extends Phaser.Scene {
aztecImg.onload = () => { aztecImg.onload = () => {
this.textures.addAtlas('aztec', aztecImg, aztecAtlas); this.textures.addAtlas('aztec', aztecImg, aztecAtlas);
}; };
this.load.bitmapFont('gothic', 'https://labs.phaser.io/assets/fonts/bitmap/gothic.png',
'https://labs.phaser.io/assets/fonts/bitmap/gothic.xml');
} }
create() { create() {
this.add.text(0, 0, 'cryps.gg', TEXT.HEADER); this.add.bitmapText(0, 0, 'gothic', 'cryps.gg', 20);
} }
} }

View File

@ -86,7 +86,7 @@ class HomeCrypList extends Phaser.Scene {
'aztec', 'aztec',
genAvatar(cryp.name) genAvatar(cryp.name)
); );
this.add.text(ROW_X + BOX_WIDTH, ROW_Y, cryp.name, TEXT.HEADER) this.add.bitmapText(ROW_X + BOX_WIDTH, ROW_Y, 'gothic', cryp.name, 20)
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
} }
@ -99,7 +99,7 @@ class HomeCrypList extends Phaser.Scene {
this.game.events.emit('CRYP_SPAWN'); this.game.events.emit('CRYP_SPAWN');
}); });
this.add this.add
.text(spawn.getCenter().x, spawn.getCenter().y, '+', TEXT.HEADER) .bitmapText(spawn.getCenter().x, spawn.getCenter().y, 'gothic', '+', 20)
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
const joinNormal = this.add const joinNormal = this.add
@ -112,7 +112,7 @@ class HomeCrypList extends Phaser.Scene {
ws.sendPlayerCrypsSet(NULL_UUID, playerCryps); ws.sendPlayerCrypsSet(NULL_UUID, playerCryps);
}); });
this.add this.add
.text(joinNormal.getCenter().x, joinNormal.getCenter().y, 'Join Normal', TEXT.HEADER) .bitmapText(joinNormal.getCenter().x, joinNormal.getCenter().y, 'gothic', 'Join Normal', 20)
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
const joinInstance = this.add const joinInstance = this.add
@ -125,7 +125,7 @@ class HomeCrypList extends Phaser.Scene {
ws.sendInstanceJoin(playerCryps); ws.sendInstanceJoin(playerCryps);
}); });
this.add this.add
.text(joinInstance.getCenter().x, joinInstance.getCenter().y, 'New Instance', TEXT.HEADER) .bitmapText(joinInstance.getCenter().x, joinInstance.getCenter().y, 'gothic', 'New Instance', 20)
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
return this; return this;

View File

@ -12,7 +12,7 @@ class HomeRankings extends Phaser.Scene {
} }
create() { create() {
this.add.text(X, Y, 'Instances Scene', TEXT.HEADER); this.add.bitmapText(X, Y, 'gothic', 'Instances Scene', 20);
const playerList = this.registry.get('playerList'); const playerList = this.registry.get('playerList');
const addInstance = (player, i) => { const addInstance = (player, i) => {
const joinNormal = this.add const joinNormal = this.add
@ -23,7 +23,7 @@ class HomeRankings extends Phaser.Scene {
this.game.events.emit('SET_PLAYER', player); this.game.events.emit('SET_PLAYER', player);
}); });
this.add this.add
.text(joinNormal.getCenter().x, joinNormal.getCenter().y, `${player.instance}`, TEXT.NORMAL) .bitmapText(joinNormal.getCenter().x, joinNormal.getCenter().y, 'gothic', `${player.instance}`, 20)
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
}; };

View File

@ -21,7 +21,7 @@ class HomeNavigation extends Phaser.Scene {
.setInteractive() .setInteractive()
.setOrigin(0); .setOrigin(0);
this.add this.add
.text(ranks.getCenter().x, ranks.getCenter().y, 'Rankings', TEXT.HEADER) .bitmapText(ranks.getCenter().x, ranks.getCenter().y, 'gothic', 'Rankings', 20)
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
ranks.on('pointerdown', () => this.registry.set('homeRankings', true)); ranks.on('pointerdown', () => this.registry.set('homeRankings', true));
@ -30,7 +30,7 @@ class HomeNavigation extends Phaser.Scene {
.setInteractive() .setInteractive()
.setOrigin(0); .setOrigin(0);
this.add this.add
.text(news.getCenter().x, news.getCenter().y, 'News', TEXT.HEADER) .bitmapText(news.getCenter().x, news.getCenter().y, 'gothic', 'News', 20)
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
news.on('pointerdown', () => this.registry.set('homeNews', true)); news.on('pointerdown', () => this.registry.set('homeNews', true));
@ -39,7 +39,7 @@ class HomeNavigation extends Phaser.Scene {
.setInteractive() .setInteractive()
.setOrigin(0); .setOrigin(0);
this.add this.add
.text(shop.getCenter().x, shop.getCenter().y, 'Shop', TEXT.HEADER) .bitmapText(shop.getCenter().x, shop.getCenter().y, 'gothic', 'Shop', 20)
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
shop.on('pointerdown', () => this.registry.set('homeShop', true)); shop.on('pointerdown', () => this.registry.set('homeShop', true));
@ -48,7 +48,7 @@ class HomeNavigation extends Phaser.Scene {
.setInteractive() .setInteractive()
.setOrigin(0); .setOrigin(0);
this.add this.add
.text(instances.getCenter().x, instances.getCenter().y, 'Instances', TEXT.HEADER) .bitmapText(instances.getCenter().x, instances.getCenter().y, 'gothic', 'Instances', 20)
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
instances.on('pointerdown', () => this.registry.set('homeInstances', true)); instances.on('pointerdown', () => this.registry.set('homeInstances', true));
} }

View File

@ -12,8 +12,8 @@ class HomeNews extends Phaser.Scene {
} }
create() { create() {
this.add.text(X, Y, 'News Scene', TEXT.HEADER); this.add.bitmapText(X, Y, 'gothic', 'News Scene', 20);
this.add.text(X, Y + HEIGHT * 0.1, 'some other stuff here', TEXT.NORMAL); this.add.bitmapText(X, Y + HEIGHT * 0.1, 'gothic', 'some other stuff here', 20);
} }
cleanUp() { cleanUp() {

View File

@ -12,8 +12,8 @@ class HomeRankings extends Phaser.Scene {
} }
create() { create() {
this.add.text(X, Y, 'Rankings Scene', TEXT.HEADER); this.add.bitmapText(X, Y, 'gothic', 'Rankings Scene', 20);
this.add.text(X, Y + HEIGHT * 0.1, 'some stuff here', TEXT.NORMAL); this.add.bitmapText(X, Y + HEIGHT * 0.1, 'gothic', 'some other stuff here', 20);
} }
cleanUp() { cleanUp() {

View File

@ -11,8 +11,8 @@ class HomeShop extends Phaser.Scene {
} }
create() { create() {
this.add.text(X, Y, 'Shop Scene', TEXT.HEADER); this.add.bitmapText(X, Y, 'gothic', 'Shop Scene', 20);
this.add.text(X, Y + HEIGHT * 0.1, 'rulul', TEXT.NORMAL); this.add.bitmapText(X, Y + HEIGHT * 0.1, 'gothic', 'some other stuff here', 20);
} }
cleanUp() { cleanUp() {