First commi using the new software

This commit is contained in:
Webeled
2013-10-11 22:26:27 +01:00
parent 574f4f351b
commit 3acdad92cb
20 changed files with 26 additions and 799 deletions
-63
View File
@@ -1,63 +0,0 @@
<?php
$title = "Adding to group using 'add'";
require('../head.php');
?>
<script type="text/javascript">
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create,render:render });
var friendAndFoe,
enemies;
function preload() {
game.load.image('ufo', 'assets/sprites/ufo.png');
game.load.image('baddie', 'assets/sprites/space-baddie.png');
}
function create() {
// Create some local groups for later use.
friendAndFoe = game.add.group();
enemies = game.add.group();
// Use game.add (GameObjectFactory) to create sprites, those
// newly created ones will be added to game.world.group
// automatically. While you can still use new to allocate and
// only add them to your own groups.
var ufo = game.add.sprite(200, 240, 'ufo');
friendAndFoe.add(ufo);
// Create some enemies using new keyword.
// (Don't forget to pass game as the first parameter.)
var enemy;
for (var i = 0; i < 16; i++) {
enemy = new Phaser.Sprite(game,
360 + Math.random() * 200, 120 + Math.random() * 200,
'baddie');
enemies.add(enemy);
}
}
function render() {
game.debug.renderText('ufo added to game.world.and "friendAndFoe" group', 20, 24);
game.debug.renderText('others ONLY added to "enemies" group', 20, 40);
}
</script>
<?php
require('../foot.php');
?>
-56
View File
@@ -1,56 +0,0 @@
<?php
$title = "Adding to group using create";
require('../head.php');
?>
<script type="text/javascript">
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create,render:render });
function preload() {
game.load.image('ufo', 'assets/sprites/ufo.png');
game.load.image('baddie', 'assets/sprites/space-baddie.png');
}
var friendAndFoe,
enemies;
function create() {
// Create some local groups for later use.
friendAndFoe = game.add.group();
enemies = game.add.group();
// You can directly create a sprite and add it to a group
// using just one line.
friendAndFoe.create(200, 240, 'ufo');
// Create some enemies.
for (var i = 0; i < 8; i++) {
createBaddie();
}
// Tap to create new baddie sprites.
game.input.onTap.add(createBaddie, this);
}
function createBaddie() {
enemies.create(360 + Math.random() * 200, 120 + Math.random() * 200,'baddie');
}
function render() {
game.debug.renderText('Tap screen or click to create new baddies.', 16, 24);
}
</script>
<?php
require('../foot.php');
?>
-101
View File
@@ -1,101 +0,0 @@
<?php
$title = "Bringing to top and game indexes";
require('../head.php');
?>
<script type="text/javascript">
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create,update:update,render:render });
function preload() {
game.load.image('beast', 'assets/pics/shadow_of_the_beast2_karamoon.png');
game.load.image('snot', 'assets/pics/nslide_snot.png');
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.load.image('coke', 'assets/sprites/cokecan.png');
game.load.image('disk', 'assets/sprites/oz_pov_melting_disk.png');
}
var group1,
group2,
coke,
disk;
function create() {
// Create a background image
game.add.sprite(0, 0, 'beast');
// Create a Group that will sit above the background image
group1 = game.add.group();
// Create a Group that will sit above Group 1
group2 = game.add.group();
// Now let's create some random sprites and enable them all for drag and 'bring to top'
for (var i = 0; i < 10; i++)
{
var tempSprite = game.add.sprite(game.stage.randomX, game.stage.randomY, 'atari1');
tempSprite.name = 'atari' + i;
tempSprite.input.start(i, true);
tempSprite.input.enableDrag(false, true);
group1.add(tempSprite);
// Sonics
var tempSprite=game.add.sprite(game.stage.randomX, game.stage.randomY, 'sonic');
tempSprite.name = 'sonic' + i;
tempSprite.input.start(10 + i, true);
tempSprite.input.enableDrag(false, true);
group2.add(tempSprite);
}
// Add 2 control sprites into each group - these cannot be dragged but should be bought to the top each time
coke = group1.create(100, 100, 'coke');
disk = group2.create(400, 300, 'disk');
// Create a foreground image - everything should appear behind this, even when dragged
var snot = game.add.sprite(game.world.centerX, game.world.height, 'snot');
snot.anchor.setTo(0.5, 1);
// You can click and drag any sprite but Sonic sprites should always appear above the Atari sprites
// and both types of sprite should only ever appear above the background and behind the
}
function update() {
if (game.input.keyboard.justReleased(Phaser.Keyboard.ONE))
{
coke.bringToTop();
}
if (game.input.keyboard.justReleased(Phaser.Keyboard.TWO))
{
disk.bringToTop();
}
}
function render() {
game.debug.renderInputInfo(32, 32);
}
</script>
<?php
require('../foot.php');
?>
-46
View File
@@ -1,46 +0,0 @@
<?php
$title = "Bring to Top using parent container";
require('../head.php');
?>
<script type="text/javascript">
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create,render : render });
var container;
function preload() {
game.load.spritesheet('button', 'assets/buttons/number-buttons.png', 160, 160);
}
function create() {
// Container for sorting the buttons, which we'll use to make buttons
// to the top later.
container = game.add.group();
// Add buttons to container.
container.add(game.add.button(200, 100, 'button', bringMeToTop, this, 0, 0, 0));
container.add(game.add.button(300, 100, 'button', bringMeToTop, this, 1, 1, 1));
container.add(game.add.button(100, 200, 'button', bringMeToTop, this, 2, 2, 2));
container.add(game.add.button(400, 200, 'button', bringMeToTop, this, 3, 3, 3));
container.add(game.add.button(300, 300, 'button', bringMeToTop, this, 4, 4, 4));
container.add(game.add.button(200, 300, 'button', bringMeToTop, this, 5, 5, 5));
}
function render() {
game.debug.renderText('Tap or click buttons to bring it to the top.', 32, 32);
}
function bringMeToTop(btn) {
container.bringToTop(btn);
}
</script>
<?php
require('../foot.php');
?>