forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext3.php
More file actions
82 lines (64 loc) · 1.32 KB
/
Copy pathtext3.php
File metadata and controls
82 lines (64 loc) · 1.32 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE HTML>
<html>
<head>
<title>phaser.js - a new beginning</title>
<?php
require('js.php');
?>
</head>
<body>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 480, Phaser.AUTO, '', { preload: preload, create: create, update: update });
var content = [
" ",
"photon storm presents",
"a phaser production",
" ",
"Kern of Duty",
" ",
"directed by rich davey",
"rendering by mat groves",
" ",
"03:45, November 4th, 2014",
"somewhere in the north pacific",
"mission control bravo ...",
];
var t = 0;
var s;
var index = 0;
var line = '';
function preload() {
game.load.image('cod', 'assets/pics/cod.jpg');
}
function create() {
game.add.sprite(0, 0, 'cod');
var style = { font: "30pt Courier", fill: "#19cb65", stroke: "#119f4e", strokeThickness: 2 };
s = game.add.text(32, 380, '', style);
t = game.time.now + 80;
}
function update() {
if (game.time.now > t && index < content.length)
{
// get the next character in the line
if (line.length < content[index].length)
{
line = content[index].substr(0, line.length + 1);
s.setText(line);
t = game.time.now + 80;
}
else
{
t = game.time.now + 2000;
if (index < content.length)
{
index++;
line = '';
}
}
}
}
})();
</script>
</body>
</html>