Lots of new examples :)

Lots of new examples, the wip/examples folder can be destoryed I think
This commit is contained in:
Webeled
2013-09-30 17:31:03 +01:00
parent 4b177e0a9b
commit bdc8edea9d
15 changed files with 807 additions and 11 deletions
+55
View File
@@ -0,0 +1,55 @@
<?php
$title = "Go fullscreen";
require('../head.php');
?>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update,render:render});
function preload() {
game.load.image('atari1', 'assets/sprites/atari130xe.png');
}
function create() {
var sprite = game.add.sprite(0, 0, 'atari1');
game.stage.backgroundColor = '#e3ed49';
// // Testing iOS7 lack of fullscreen. Damnit.
// document.documentElement['style'].minHeight = '2000px';
// window.scrollTo(0, document.body.scrollHeight);
game.input.onDown.add(gofull, this);
}
function gofull() {
game.stage.scale.startFullScreen();
}
function update() {
if (document.getElementsByTagName('body')[0].scrollTop > 1000)
{
game.stage.backgroundColor = '#87ff55';
window.scrollTo(0, 0);
}
}
function render () {
game.debug.renderText('Tap to go fullscreen',15,150);
}
})();
</script>
<?php
require('../foot.php');
?>
+65
View File
@@ -0,0 +1,65 @@
<?php
$title = "Using LinkedLists";
require('../head.php');
?>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { 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 a;
var b;
var c;
var d;
var e;
var f;
var list;
function create() {
a = game.add.sprite(100, 100, 'ship');
a.name = 's1';
b = game.add.sprite(130, 100, 'ship');
b.name = 's2';
c = game.add.sprite(160, 100, 'ship');
c.name = 's3';
d = game.add.sprite(190, 100, 'alien');
d.name = 'a1';
e = game.add.sprite(220, 100, 'alien');
e.name = 'a2';
f = game.add.sprite(250, 100, 'alien');
f.name = 'a3';
list = new Phaser.LinkedList();
list.add(a.input);
list.add(b.input);
list.add(c.input);
list.add(d.input);
list.add(e.input);
list.add(f.input);
list.dump();
// list.remove(d.input);
// list.dump();
}
})();
</script>
<?php
require('../foot.php');
?>