2013-09-10 00:26:50 +00:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>phaser.js - a new beginning</title>
|
|
|
|
<?php
|
|
|
|
require('js.php');
|
|
|
|
?>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
|
|
|
|
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });
|
|
|
|
|
|
|
|
var p;
|
2013-09-10 10:09:25 +00:00
|
|
|
var p2;
|
2013-09-10 00:26:50 +00:00
|
|
|
|
|
|
|
function preload() {
|
|
|
|
|
2013-09-13 03:22:12 +00:00
|
|
|
// game.load.image('carrot', 'assets/sprites/carrot.png');
|
|
|
|
// game.load.image('star', 'assets/misc/star_particle.png');
|
|
|
|
// game.load.image('diamond', 'assets/sprites/diamond.png');
|
|
|
|
// game.load.image('dude', 'assets/sprites/phaser-dude.png');
|
|
|
|
// game.load.image('coke', 'assets/sprites/cokecan.png');
|
|
|
|
// game.load.atlasJSONHash('pixies', 'assets/sprites/pixi_monsters.png', 'assets/sprites/pixi_monsters.json');
|
2013-09-10 10:09:25 +00:00
|
|
|
game.load.spritesheet('balls', 'assets/sprites/balls.png', 17, 17);
|
2013-09-10 00:26:50 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
2013-09-10 10:09:25 +00:00
|
|
|
game.stage.backgroundColor = 0x337799;
|
|
|
|
|
2013-09-13 03:22:12 +00:00
|
|
|
p = game.add.emitter(100, 100, 250);
|
2013-09-10 00:26:50 +00:00
|
|
|
|
|
|
|
// p.width = 200;
|
|
|
|
// p.height = 200;
|
|
|
|
|
2013-09-10 10:09:25 +00:00
|
|
|
// keys, frames, quantity, collide
|
|
|
|
// p.makeParticles(['diamond', 'carrot', 'star']);
|
2013-09-13 03:22:12 +00:00
|
|
|
p.makeParticles('balls', [0,1,2,3,4,5]);
|
|
|
|
// p.makeParticles('pixies', [0,1,2,3]);
|
2013-09-10 10:18:50 +00:00
|
|
|
|
2013-09-13 03:22:12 +00:00
|
|
|
// p.minParticleScale = 0.1;
|
|
|
|
// p.maxParticleScale = 0.5;
|
2013-09-10 00:26:50 +00:00
|
|
|
|
|
|
|
// Steady constant stream at 250ms delay and 10 seconds lifespan
|
|
|
|
// p.start(false, 10000, 250, 100);
|
|
|
|
// p.start(true, 10000);
|
|
|
|
|
|
|
|
// explode, lifespan, frequency, quantity
|
|
|
|
p.minParticleSpeed.setTo(-100, -100);
|
|
|
|
p.maxParticleSpeed.setTo(100, -200);
|
|
|
|
p.gravity = 10;
|
|
|
|
p.start(false, 3000, 10);
|
|
|
|
|
2013-09-13 03:22:12 +00:00
|
|
|
game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);
|
2013-09-10 00:26:50 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function update() {
|
2013-09-13 03:22:12 +00:00
|
|
|
|
|
|
|
p.y = game.math.min(100, game.input.y);
|
|
|
|
|
2013-09-10 00:26:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|