Close #40 : Integrated gothic bitmap font and added helpers for it

This commit is contained in:
2014-07-13 21:37:51 -07:00
parent 7f14cd5720
commit d68fda19a8
7 changed files with 65 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -4,6 +4,10 @@ SCREEN_HEIGHT = 480;
SCREEN_OFFSET_RECENTLYSTOLEN = new Phaser.Point(240, SCREEN_HEIGHT - 32);
RECENTLYSTOLEN_MAX = 5;
FONTSIZE_SMALL = 8;
FONTSIZE_MEDIUM = 16;
FONTSIZE_LARGE = 32;
SPEED_WALKING = 8;
SPEED_RUNNING = 14;

View File

@@ -572,20 +572,36 @@ var StartScreen = function(game) {
StartScreen.prototype.create = function()
{
this.startGameButton = game.add.button((640 / 2) - (224/2),
this.labeltext = bitmapText("(C) 2014 Andrew Kesterson - http://akesterson.itch.io/",
FONTSIZE_SMALL);
this.linkButton = game.add.button(game.world.centerX,
460,
this.labeltext,
this.linkClicked,
this);
this.linkButton.anchor.setTo(0.5, 0.5);
this.startGameButton = game.add.button(game.world.centerX,
100,
'newgamebtn',
this.startGameClicked,
this,
1,
0);
this.creditsButton = game.add.button((640 / 2) - (182/2),
this.startGameButton.anchor.setTo(0.5, 0.5);
this.creditsButton = game.add.button(game.world.centerX,
200,
'creditsbtn',
this.creditsClicked,
this,
1,
0);
this.creditsButton.anchor.setTo(0.5, 0.5);
}
StartScreen.prototype.linkClicked = function()
{
window.open("http://akesterson.itch.io/");
}
StartScreen.prototype.startGameClicked = function()

View File

@@ -147,6 +147,18 @@ var moonlightSettings = {
}
],
'images': [
{
'name': 'font-32px',
'path': 'gfx/ui/font-32px.png'
},
{
'name': 'font-16px',
'path': 'gfx/ui/font-16px.png'
},
{
'name': 'font-8px',
'path': 'gfx/ui/font-8px.png'
},
{
'name': 'gameover',
'path': 'gfx/ui/gameover.png'

View File

@@ -478,3 +478,22 @@ function setConversation(obj1, obj2)
finisher.clearWordBubble(false);
starter.enableWordBubble();
}
function textImage(x, y, str, size, align)
{
var text = bitmapText(str, size, align);
return game.add.image(x, y, text);
}
function bitmapText(str, size, align)
{
size = ( typeof size == 'undefined' ? FONTSIZE_SMALL : size);
align = ( typeof align == 'undefined' ? Phaser.RetroFont.ALIGN_LEFT : align );
var textobj = game.add.retroFont('font-' + size + 'px',
size,
size * 2,
Phaser.RetroFont.TEXT_SET1,
16);
textobj.setText(str, true, 0, 0, align, true);
return textobj;
}