diff --git a/examples/assets/audio/SoundEffects/squit.mp3 b/examples/assets/audio/SoundEffects/squit.mp3 new file mode 100644 index 00000000..24a6d7e9 Binary files /dev/null and b/examples/assets/audio/SoundEffects/squit.mp3 differ diff --git a/examples/assets/audio/SoundEffects/squit.ogg b/examples/assets/audio/SoundEffects/squit.ogg new file mode 100644 index 00000000..e28915ba Binary files /dev/null and b/examples/assets/audio/SoundEffects/squit.ogg differ diff --git a/examples/audio/loop.php b/examples/audio/loop.php new file mode 100644 index 00000000..cfbc76de --- /dev/null +++ b/examples/audio/loop.php @@ -0,0 +1,51 @@ + + + + + diff --git a/examples/buttons/action on click.php b/examples/buttons/action on click.php new file mode 100644 index 00000000..ad4e3444 --- /dev/null +++ b/examples/buttons/action on click.php @@ -0,0 +1,48 @@ + + + + + diff --git a/examples/buttons/changing the frames.php b/examples/buttons/changing the frames.php new file mode 100644 index 00000000..f61316c4 --- /dev/null +++ b/examples/buttons/changing the frames.php @@ -0,0 +1,55 @@ + + + + + diff --git a/examples/buttons/rotated buttons.php b/examples/buttons/rotated buttons.php new file mode 100644 index 00000000..44d33369 --- /dev/null +++ b/examples/buttons/rotated buttons.php @@ -0,0 +1,56 @@ + + + + + diff --git a/examples/camera/basic follow.php b/examples/camera/basic follow.php new file mode 100644 index 00000000..c44fa560 --- /dev/null +++ b/examples/camera/basic follow.php @@ -0,0 +1,76 @@ + + + + + + diff --git a/examples/camera/moving the game camera.php b/examples/camera/moving the game camera.php new file mode 100644 index 00000000..d1dcb921 --- /dev/null +++ b/examples/camera/moving the game camera.php @@ -0,0 +1,60 @@ + + + + + + diff --git a/examples/sprites/sprite4.php b/examples/sprites/sprite4.php index fbbc121a..161c1830 100644 --- a/examples/sprites/sprite4.php +++ b/examples/sprites/sprite4.php @@ -17,8 +17,6 @@ function create() { - // game.world._stage.backgroundColorString = '#182d3b'; - s = game.add.sprite(game.world.centerX, game.world.centerY, 'bot'); // s.anchor.setTo(0.5, 0.5); s.scale.setTo(2, 2); diff --git a/examples/sprites/sprite2.php b/examples/sprites/spritesheet.php similarity index 100% rename from examples/sprites/sprite2.php rename to examples/sprites/spritesheet.php diff --git a/src/core/Camera.js b/src/core/Camera.js index 4d0cf1c1..b738e5f5 100644 --- a/src/core/Camera.js +++ b/src/core/Camera.js @@ -3,6 +3,15 @@ * * A Camera is your view into the game world. It has a position and size and renders only those objects within its field of view. * The game automatically creates a single Stage sized camera on boot. Move the camera around the world with Phaser.Camera.x/y +* +* @class Phaser.Camera +* @constructor +* @param game {Phaser.Game} game reference to the currently running game. +* @param id {number} not being used at the moment, will be when Phaser supports multiple camera +* @param x {number} position of the camera on the X axis +* @param y {number} position of the camera on the Y axis +* @param width {number} the width of the view rectangle +* @param height {number} the height of the view rectangle */ Phaser.Camera = function (game, id, x, y, width, height) { diff --git a/src/core/Stage.js b/src/core/Stage.js index bbdf967b..12859f86 100644 --- a/src/core/Stage.js +++ b/src/core/Stage.js @@ -8,6 +8,13 @@ * @author Richard Davey * @copyright 2013 Photon Storm Ltd. * @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License + + +* @class Phaser.Camera +* @constructor +* @param game {Phaser.Game} game reference to the currently running game. +* @param width {number} width of the canvas element +* @param height {number} height of the canvas element */ Phaser.Stage = function (game, width, height) { diff --git a/src/core/World.js b/src/core/World.js index 92c153e0..9fb89b6e 100644 --- a/src/core/World.js +++ b/src/core/World.js @@ -11,6 +11,10 @@ * @author Richard Davey * @copyright 2013 Photon Storm Ltd. * @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License + + * @class World + * @constructor + * @param game {Phaser.Game} reference to the current game instance. */ Phaser.World = function (game) { @@ -91,7 +95,7 @@ Phaser.World.prototype = { /** * Updates the size of this world. - * + * @method setSize * @param width {number} New width of the world. * @param height {number} New height of the world. */ @@ -111,6 +115,7 @@ Phaser.World.prototype = { /** * Destroyer of worlds. + * @method setSize */ destroy: function () { diff --git a/src/gameobjects/Button.js b/src/gameobjects/Button.js index 5a063fe7..9aea5634 100644 --- a/src/gameobjects/Button.js +++ b/src/gameobjects/Button.js @@ -1,5 +1,7 @@ /** * Create a new Button object. +* @class Button +* @constructor * * @param game {Phaser.Game} Current game instance. * @param [x] {number} X position of the button. @@ -58,7 +60,15 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame, Phaser.Button.prototype = Phaser.Utils.extend(true, Phaser.Sprite.prototype, PIXI.Sprite.prototype); Phaser.Button.prototype.constructor = Phaser.Button; -// Add our own custom methods +/** +* Used to manually set the frames that will be used for the different states of the button +* exactly like setting them in the constructor +* +* @method setFrames +* @param [overFrame] {string|number} This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name. +* @param [outFrame] {string|number} This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name. +* @param [downFrame] {string|number} This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name. +*/ Phaser.Button.prototype.setFrames = function (overFrame, outFrame, downFrame) { diff --git a/src/sound/Sound.js b/src/sound/Sound.js index 9774fbb0..3f685c20 100644 --- a/src/sound/Sound.js +++ b/src/sound/Sound.js @@ -1,7 +1,17 @@ +/** +* The Sound class +* +* @class Sound +* @constructor +* @param game {Phaser.Game} reference to the current game instance. +* @param key {string} Asset key for the sound. +* @param volume {number} default value for the volume. +* @param loop {bool} Whether or not the sound will loop. +*/ Phaser.Sound = function (game, key, volume, loop) { volume = volume || 1; - loop = loop || false; + if (typeof loop == 'undefined') { loop = false; } this.game = game; this.name = ''; @@ -187,8 +197,8 @@ Phaser.Sound.prototype = { marker = marker || ''; position = position || 0; volume = volume || 1; - loop = loop || false; - forceRestart = forceRestart || false; + if (typeof loop == 'undefined') { loop = false; } + if (typeof forceRestart == 'undefined') { forceRestart = false; } // console.log('play ' + marker + ' position ' + position + ' volume ' + volume + ' loop ' + loop); @@ -356,7 +366,7 @@ Phaser.Sound.prototype = { marker = marker || ''; position = position || 0; volume = volume || 1; - loop = loop || false; + if (typeof loop == 'undefined') { loop = false; } this.play(marker, position, volume, loop, true);