Add fancy pixel font

This commit is contained in:
Aaron Fischer 2017-08-31 13:54:57 +02:00
parent 38665f9c08
commit 3cbce7cddb
4 changed files with 18 additions and 6 deletions

BIN
src/assets/PixelText.ttf Normal file

Binary file not shown.

View file

@ -1,3 +1,8 @@
@font-face {
font-family: pixel;
src: url(PixelText.ttf)
}
body { body {
background-color: black; background-color: black;
margin-top: 50px; margin-top: 50px;
@ -46,4 +51,6 @@ canvas {
display: block; display: block;
position: absolute; position: absolute;
text-align: left; text-align: left;
font-family: pixel;
font-size: 3em;
} }

View file

@ -11,7 +11,7 @@
dom.innerHTML = ''; dom.innerHTML = '';
dom.style.left = position[0]*8; dom.style.left = position[0]*8;
dom.style.top = position[1]*8; dom.style.top = position[1]*8-18;
var parts = text.split(' '); var parts = text.split(' ');
var showFragment = function() { var showFragment = function() {
@ -40,7 +40,7 @@
} }
bubble.skip('talk'); bubble.skip('talk');
var text = texts.shift(); var text = texts.shift();
return show(text, position || [5, 44]) return show(text, position || [5, 52])
.then(function(what) { .then(function(what) {
if (what === 'talk') { if (what === 'talk') {
return Promise.resolve(what); return Promise.resolve(what);

View file

@ -8,7 +8,8 @@
var doorSprite = null; var doorSprite = null;
var roomState = { var roomState = {
isDoorOpen: false, isDoorOpen: false,
isLightOn: false isLightOn: false,
isIntroRunning: true
}; };
stasis.init = function() { stasis.init = function() {
@ -35,6 +36,7 @@
kontra.sprite({x: 15, y: 12, width: 3, height: 2, kontra.sprite({x: 15, y: 12, width: 3, height: 2,
image: kontra.assets.images.stasis_lightSwitch})) image: kontra.assets.images.stasis_lightSwitch}))
.addCallback(function() { .addCallback(function() {
if (roomState.isIntroRunning) return;
if (!roomState.isLightOn) { if (!roomState.isLightOn) {
roomState.isLightOn = true; roomState.isLightOn = true;
muri.get('bubble') muri.get('bubble')
@ -52,9 +54,12 @@
muri.get('bubble') muri.get('bubble')
.story([ .story([
[['Beep', 'Bip, Bip'], [20, 15]], [['Beep', 'Bip, Bip'], [20, 15]],
[['Urgh ... ...', 'Where I am?', 'What happened?'], [35, 40]], [['Urgh ... ...', 'Where I am?', 'What happened?'], [40, 35]],
[['I can\'t see a thing ...', '... need to turn on the light ...'], [35, 40]] [['I can\'t see a thing ...', '... need to turn on the light ...'], [40, 35]]
]); ])
.then(function() {
roomState.isIntroRunning = false;
});
} }
}; };