Skip to content

Commit

Permalink
Adding more examples in.
Browse files Browse the repository at this point in the history
  • Loading branch information
photonstorm committed Sep 15, 2013
1 parent f069107 commit 8c9a7c8
Show file tree
Hide file tree
Showing 9 changed files with 293 additions and 81 deletions.
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Try out the [Phaser Test Suite](http://gametest.mobi/phaser/)
Latest Update
-------------

September 15th 2013

Version 1.0.1 and 1.0.2 have been tagged and released. See the Change Log for full details. As 1.0 is so fresh please expect small minor updates every few days, but we will be sure to tag them.

September 13th 2013

We're very pleased to have finally shipped the 1.0 release of Phaser. This version represents many months of hard work, feedback and refactoring based on the previous 0.5 through to 0.97 releases. You can see the full gory details in our change log.
Expand All @@ -34,6 +38,21 @@ Phaser is everything we ever wanted from an HTML5 game framework. It will power

![Blasteroids](http://www.photonstorm.com/wp-content/uploads/2013/04/phaser_blaster.png)

Change Log
----------

Version 1.0.2

* Added optional parameter to Animation.stop: resetFrame. If true the animation will be stopped and then the current frame reset to the first frame in the animation.

Version 1.0.1

* Added checks into every Group function to ensure that the Group has children before running them.
* Added optional flag to Group.create which allows you to set the default exists state of the Sprites.
* Sprite.animation.stop no longer needs an animation name parameter, will default to stopping the current animation.
* Fixed the license in package.json
* Fixed a logic bug in the separateTileX function that would sometimes cause tunneling of big sprites through small tiles.

Requirements
------------

Expand Down Expand Up @@ -113,17 +132,6 @@ Although Phaser 1.0 is a brand new release it is born from years of experience b

![Phaser Particles](http://www.photonstorm.com/wp-content/uploads/2013/04/phaser_particles.png)

Change Log
----------

Version 1.0.1

* Added checks into every Group function to ensure that the Group has children before running them.
* Added optional flag to Group.create which allows you to set the default exists state of the Sprites.
* Sprite.animation.stop no longer needs an animation name parameter, will default to stopping the current animation.
* Fixed the license in package.json
* Fixed a logic bug in the separateTileX function that would sometimes cause tunneling of big sprites through small tiles.

Known Issues
------------

Expand Down
2 changes: 1 addition & 1 deletion examples/assets/games/starstruck/level1.json

Large diffs are not rendered by default.

128 changes: 64 additions & 64 deletions examples/assets/games/starstruck/level1.tmx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/games/starstruck.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function create() {
bg.scrollFactor.setTo(0, 0);

map = game.add.tilemap(0, 0, 'level1');
map.setCollisionRange(1, 20, true, true, true, true);
map.setCollisionRange(1, 12, true, true, true, true);
map.setCollisionRange(18, 47, true, true, true, true);
map.setCollisionRange(53, 69, true, true, true, true);

Expand Down
72 changes: 72 additions & 0 deletions examples/particles/click burst.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
$title = "Click to Burst";
require('../head.php');
?>

<script type="text/javascript">

(function () {

var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });

var p;
var p2;

function preload() {

// 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');
game.load.spritesheet('balls', 'assets/sprites/balls.png', 17, 17);

}

function create() {

game.stage.backgroundColor = 0x337799;

p = game.add.emitter(0, 0, 200);

p.makeParticles('diamond');

// 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;

// game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);

game.input.onDown.add(particleBurst, this);

}

function particleBurst() {

p.x = game.input.x;
p.y = game.input.y;
p.start(true, 2000, 10, 10);

}

function update() {

// p.y = game.math.min(100, game.input.y);

}

function render() {
}

})();
</script>

<?php
require('../foot.php');
?>
77 changes: 77 additions & 0 deletions examples/particles/diamond burst.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
$title = "Diamond Burst";
require('../head.php');
?>

<script type="text/javascript">

(function () {

var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });

var p;
var p2;

function preload() {

// 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');
// game.load.spritesheet('balls', 'assets/sprites/balls.png', 17, 17);

}

function create() {

game.stage.backgroundColor = 0x337799;

p = game.add.emitter(game.world.centerX, 200, 200);

// p.width = 200;
// p.height = 200;

// keys, frames, quantity, collide

p.makeParticles('diamond');

// p.makeParticles(['diamond', 'carrot', 'star']);
// p.makeParticles('balls', [0,1,2,3,4,5]);
// p.makeParticles('pixies', [0,1,2,3]);

// p.minParticleScale = 0.1;
// p.maxParticleScale = 0.5;

// 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);
p.start(false, 5000, 20);

// game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);

}

function update() {

// p.y = game.math.min(100, game.input.y);

}

function render() {
}

})();
</script>

<?php
require('../foot.php');
?>
46 changes: 46 additions & 0 deletions examples/particles/random sprite.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
$title = "Random Sprite";
require('../head.php');
?>

<script type="text/javascript">

(function () {

var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });

var emitter;

function preload() {

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');

}

function create() {

game.stage.backgroundColor = 0x337799;

emitter = game.add.emitter(game.world.centerX, 200, 200);

// Here we're passing an array of image keys. It will pick one at random when emitting a new particle.
emitter.makeParticles(['diamond', 'carrot', 'star']);

emitter.start(false, 5000, 20);

}

function update() {
}

function render() {
}

})();
</script>

<?php
require('../foot.php');
?>
9 changes: 8 additions & 1 deletion src/animation/Animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,18 @@ Phaser.Animation.prototype = {
/**
* Stop playing animation and set it finished.
*/
stop: function () {
stop: function (resetFrame) {

if (typeof resetFrame == 'undefined') { resetFrame = false; }

this.isPlaying = false;
this.isFinished = true;

if (resetFrame)
{
this.currentFrame = this._frameData.getFrame(this._frames[0]);
}

},

/**
Expand Down
8 changes: 5 additions & 3 deletions src/animation/AnimationManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,23 @@ Phaser.AnimationManager.prototype = {
* Stop animation. If a name is given that specific animation is stopped, otherwise the current one is stopped.
* Current animation will be automatically set to the stopped one.
*/
stop: function (name) {
stop: function (name, resetFrame) {

if (typeof resetFrame == 'undefined') { resetFrame = false; }

if (typeof name == 'string')
{
if (this._anims[name])
{
this.currentAnim = this._anims[name];
this.currentAnim.stop();
this.currentAnim.stop(resetFrame);
}
}
else
{
if (this.currentAnim)
{
this.currentAnim.stop();
this.currentAnim.stop(resetFrame);
}
}

Expand Down

0 comments on commit 8c9a7c8

Please sign in to comment.