mirror of
https://github.com/wassname/phaser.git
synced 2026-07-11 00:40:20 +08:00
1.0.3 release - fixed Text and Bitmap Fonts, Animation documentation and more examples
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
$title = "Bitmap Fonts ahoy";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.bitmapFont('desyrel', 'assets/fonts/desyrel.png', 'assets/fonts/desyrel.xml');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
game.add.bitmapText(200, 100, 'Phaser & Pixi\nrocking!', { font: '64px Desyrel', align: 'center' });
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$title = "Hello Arial";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { create: create });
|
||||
|
||||
function create() {
|
||||
|
||||
var text = "- phaser -\nwith a sprinkle of\npixi dust";
|
||||
var style = { font: "65px Arial", fill: "#ff0044", align: "center" };
|
||||
|
||||
var t = game.add.text(game.world.centerX, game.world.centerY, text, style);
|
||||
t.anchor.setTo(0.5, 0.5);
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
$title = "Kern of Duty";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<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>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
$title = "Text Stroke";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { create: create, update: update });
|
||||
|
||||
var s;
|
||||
|
||||
function create() {
|
||||
|
||||
var text = "--- phaser ---\nwith a sprinkle of\npixi dust";
|
||||
var style = { font: "bold 40pt Arial", fill: "#ffffff", align: "center", stroke: "#258acc", strokeThickness: 8 };
|
||||
|
||||
s = game.add.text(game.world.centerX, game.world.centerY, text, style);
|
||||
s.anchor.setTo(0.5, 0.5);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
s.angle += 1;
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
Reference in New Issue
Block a user