Final Commit of the day,

Final commit, the wip/examples folder can be removed,
This commit is contained in:
Webeled
2013-09-30 19:13:01 +01:00
parent bdc8edea9d
commit 933edb203f
6 changed files with 201 additions and 2 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
(function () {
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create,update:update,render:render});
var game = new Phaser.Game(320, 240, Phaser.CANVAS, '', { preload: preload, create: create,update:update,render:render});
function preload() {
@@ -0,0 +1,60 @@
<?php
$title = "Multi Touch";
require('../head.php');
?>
<script type="text/javascript">
(function () {
function loadStarted(size) {
console.log('Loader started, queue size:', size);
}
// this.progress, previousKey, success, this.queueSize - this._keys.length, this.queueSize
function fileLoaded(progress, key, success, remaining, total) {
console.log('File Loaded:', key);
console.log('Progress: ' + progress + '%');
console.log('File: ' + remaining + ' out of ' + total);
}
function loadCompleted() {
console.log('Loader finished');
// Let's try adding an image to the DOM
document.body.appendChild(game.cache.getImage('cockpit'));
// And some text
var para = document.createElement('pre');
para.innerHTML = game.cache.getText('copyright');
document.body.appendChild(para);
}
var game = new Phaser.Game(320, 240, Phaser.AUTO, '', {preload:preload});
function preload () {
game.load.image('cockpit', 'assets/pics/cockpit.png');
game.load.image('rememberMe', 'assets/pics/remember-me.jpg');
game.load.image('overdose', 'assets/pics/lance-overdose-loader_eye.png');
game.load.text('copyright', 'assets/warning - copyright.txt');
game.load.onLoadStart.add(loadStarted, this);
game.load.onFileComplete.add(fileLoaded, this);
game.load.onLoadComplete.add(loadCompleted, this);
}
})();
</script>
<?php
require('../foot.php');
?>
+54
View File
@@ -0,0 +1,54 @@
<?php
$title = "Loading and caching a spritesheet";
require('../head.php');
?>
<script type="text/javascript">
(function () {
function loadStarted(size) {
console.log('Loader started, queue size:', size);
}
// this.progress, previousKey, success, this.queueSize - this._keys.length, this.queueSize
function fileLoaded(progress, key, success, remaining, total) {
console.log('File Loaded:', key);
console.log('Progress: ' + progress + '%');
console.log('File: ' + remaining + ' out of ' + total);
}
function loadCompleted() {
console.log('Loader finished');
// Let's try adding an image to the DOM
document.body.appendChild(game.cache.getImage('mummy'));
// Dump the animation data out
console.log(game.cache.getFrameData('mummy'));
}
var game = new Phaser.Game(320, 240, Phaser.AUTO, '', {preload:preload});
function preload () {
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45);
game.load.onLoadStart.add(loadStarted, this);
game.load.onFileComplete.add(fileLoaded, this);
game.load.onLoadComplete.add(loadCompleted, this);
}
})();
</script>
<?php
require('../foot.php');
?>
-1
View File
@@ -18,7 +18,6 @@
// Add some values to the query string
game.debug.renderText('Query string with new values : '+game.net.updateQueryString('atari', '520'),game.world.centerX-400,80);
game.debug.renderText('Query string with new values : '+game.net.updateQueryString('amiga', '1200'),game.world.centerX-400,100);
game.debug.renderText('Query string with new values : '+game.net.updateQueryString('commodore', '64'),game.world.centerX-400,120);
console.log('Query String: '+game.net.getQueryString(),game.world.centerX-300,140);
console.log('Query String Param: '+game.net.getQueryString('atari'),game.world.centerX-300,160);
+32
View File
@@ -0,0 +1,32 @@
<?php
$title = "Random Data Generators";
require('../head.php');
?>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', {create: create });
function create() {
game.stage.backgroundColor = '#454645';
var style = { font: "14px Arial", fill: "#ff0044", align: "center" };
game.add.text(10,20,game.rnd.integer());
game.add.text(10,40,game.rnd.frac());
game.add.text(10,60,game.rnd.real());
game.add.text(10,80,game.rnd.integerInRange(100,200));
}
})();
</script>
<?php
require('../foot.php');
?>
+54
View File
@@ -0,0 +1,54 @@
<?php
$title = "Sprite is out of world bounds";
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.image('alien', 'assets/sprites/space-baddie.png');
game.load.image('ship', 'assets/sprites/shmup-ship.png');
}
var player,
aliens;
function create() {
player = game.add.sprite(400, 500, 'ship');
player.anchor.setTo(0.5, 0.5);
aliens = game.add.group();
for (var y = 0; y < 4; y++)
{
for (var x = 0; x < 10; x++)
{
var alien = aliens.create(200 + x * 48, y * 50, 'alien');
alien.name = 'alien' + x.toString() + y.toString();
alien.events.onOutOfBounds.add(alienOut, this);
alien.body.velocity.y = 50 + Math.random() * 200;
}
}
}
function alienOut(alien) {
// Move the alien to the top of the screen again
alien.reset(alien.x, -32);
// And give it a new random velocity
alien.body.velocity.y = 50 + Math.random() * 200;
}
})();
</script>
<?php
require('../foot.php');
?>