Skip to content

Commit

Permalink
Final Commit of the day,
Browse files Browse the repository at this point in the history
Final commit, the wip/examples folder can be removed,
  • Loading branch information
Webeled committed Sep 30, 2013
1 parent bdc8ede commit 933edb2
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/input/game scale.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down
60 changes: 60 additions & 0 deletions examples/loader/loading multiple files.php
Original file line number Diff line number Diff line change
@@ -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 changes: 54 additions & 0 deletions examples/loader/spritesheet loading.php
Original file line number Diff line number Diff line change
@@ -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 change: 0 additions & 1 deletion examples/misc/net.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function render () {
// 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);
Expand Down
32 changes: 32 additions & 0 deletions examples/misc/random generators.php
Original file line number Diff line number Diff line change
@@ -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 changes: 54 additions & 0 deletions examples/sprites/outOfBounds.php
Original file line number Diff line number Diff line change
@@ -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');
?>

0 comments on commit 933edb2

Please sign in to comment.