Revamping the examples area.

This commit is contained in:
photonstorm
2013-10-22 03:58:20 +01:00
parent 82df8c9f54
commit 07724e5001
380 changed files with 8619 additions and 10707 deletions
+22
View File
@@ -0,0 +1,22 @@
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
function preload() {
game.load.bitmapFont('desyrel', 'assets/fonts/desyrel.png', 'assets/fonts/desyrel.xml');
}
var text;
function create() {
text = game.add.bitmapText(200, 100, 'Phaser & Pixi\nrocking!', { font: '64px Desyrel', align: 'center' });
}
function update() {
text.setText('Phaser & Pixi\nrocking!\n' + Math.round(game.time.now));
}
-37
View File
@@ -1,37 +0,0 @@
<?php
$title = "Bitmap Fonts ahoy";
require('../head.php');
?>
<script type="text/javascript">
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
function preload() {
game.load.bitmapFont('desyrel', 'assets/fonts/desyrel.png', 'assets/fonts/desyrel.xml');
}
var text;
function create() {
text = game.add.bitmapText(200, 100, 'Phaser & Pixi\nrocking!', { font: '64px Desyrel', align: 'center' });
}
function update() {
text.setText('Phaser & Pixi\nrocking!\n' + Math.round(game.time.now));
}
</script>
<?php
require('../foot.php');
?>
+13
View File
@@ -0,0 +1,13 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { 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);
}
-24
View File
@@ -1,24 +0,0 @@
<?php
$title = "Hello Arial";
require('../head.php');
?>
<script type="text/javascript">
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');
?>
+62
View File
@@ -0,0 +1,62 @@
var game = new Phaser.Game(800, 480, Phaser.AUTO, 'phaser-example', { 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 = '';
}
}
}
}
-78
View File
@@ -1,78 +0,0 @@
<?php
$title = "Kern of Duty";
require('../head.php');
?>
<script type="text/javascript">
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');
?>
+19
View File
@@ -0,0 +1,19 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { create: create });
var text;
function create() {
text = game.add.text(game.world.centerX, game.world.centerY, "- phaser -\nclick to remove", { font: "65px Arial", fill: "#ff0044", align: "center" });
text.anchor.setTo(0.5, 0.5);
game.input.onDown.addOnce(removeText, this);
}
function removeText() {
text.destroy();
}
-32
View File
@@ -1,32 +0,0 @@
<?php
$title = "Removing Text";
require('../head.php');
?>
<script type="text/javascript">
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { create: create });
var text;
function create() {
text = game.add.text(game.world.centerX, game.world.centerY, "- phaser -\nclick to remove", { font: "65px Arial", fill: "#ff0044", align: "center" });
text.anchor.setTo(0.5, 0.5);
game.input.onDown.addOnce(removeText, this);
}
function removeText() {
// game.world.remove(text);
text.destroy();
}
</script>
<?php
require('../foot.php');
?>
+18
View File
@@ -0,0 +1,18 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { 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;
}
-34
View File
@@ -1,34 +0,0 @@
<?php
$title = "Text Stroke";
require('../head.php');
?>
<script type="text/javascript">
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');
?>