-
Notifications
You must be signed in to change notification settings - Fork 8
/
core.js
44 lines (36 loc) · 1.62 KB
/
core.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright © 2015 Michael Dobekidis
// Licensed under the terms of the MIT License
var reg = {};
var GameState = function (game) {};
var slider;
// Load images and sounds
GameState.prototype.preload = function () {
this.load.image('bg', "assets/diary-book.png");
this.load.audio('track', ['assets/pencilsketching.mp3']);
//
this.game.load.bitmapFont('chillerBlack','assets/chillerBlack/chillerBlack.png', 'assets/chillerBlack/chillerBlack.fnt');
};
// Setup the example
GameState.prototype.create = function () {
// Set stage background to something sky colored
this.game.stage.backgroundColor = 0x1e1e1e;
this.add.image(150, 0, "bg");
reg.track = _game.add.audio('track');
///////////////////////// TYPEWRITER ///////////////////////////////////////////////////////
var typewriter = new Typewriter();
typewriter.init(_game, {
x: 200,
y: 40,
fontFamily: "chillerBlack",
fontSize: 28,
maxWidth: 300,
sound: reg.track,
text: "In the times before pyramids, parthenon, atlantis or civilization, an already ancient evil existed, with the rise of the humans it saw an opportunity, to convert the nations of man into an image of it self, after all they were seen as weak and fragile. And so it started almost five thousand years ago to convert humans into the monstrosity it was. Soon after, civilizations were erased from history and memory and an undead monstrous army emerged."
});
typewriter.start();
};
// The update() method is called every frame
GameState.prototype.update = function () {
};
var _game = new Phaser.Game(1024, 600, Phaser.CANVAS, 'game');
_game.state.add('game', GameState, true);