mirror of
https://github.com/wassname/phaser.git
synced 2026-08-15 12:45:11 +08:00
It loops but still problems on the constructor
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@
|
||||
* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
|
||||
|
||||
|
||||
* @class Phaser.Camera
|
||||
* @class Stage
|
||||
* @constructor
|
||||
* @param game {Phaser.Game} game reference to the currently running game.
|
||||
* @param width {number} width of the canvas element
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ Phaser.World.prototype = {
|
||||
|
||||
/**
|
||||
* Destroyer of worlds.
|
||||
* @method setSize
|
||||
* @method destroy
|
||||
*/
|
||||
destroy: function () {
|
||||
|
||||
|
||||
+7
-2
@@ -20,6 +20,7 @@ Phaser.Sound = function (game, key, volume, loop) {
|
||||
this._volume = volume;
|
||||
this.markers = {};
|
||||
|
||||
|
||||
/**
|
||||
* Reference to AudioContext instance.
|
||||
*/
|
||||
@@ -109,7 +110,7 @@ Phaser.Sound.prototype = {
|
||||
addMarker: function (name, start, stop, volume, loop) {
|
||||
|
||||
volume = volume || 1;
|
||||
loop = loop || false;
|
||||
if (typeof loop == 'undefined') { loop = false; }
|
||||
|
||||
this.markers[name] = {
|
||||
name: name,
|
||||
@@ -187,7 +188,9 @@ Phaser.Sound.prototype = {
|
||||
|
||||
/**
|
||||
* Play this sound, or a marked section of it.
|
||||
|
||||
* @param marker {string} Assets key of the sound you want to play.
|
||||
* @param position {number} the starting position
|
||||
* @param [volume] {number} volume of the sound you want to play.
|
||||
* @param [loop] {bool} loop when it finished playing? (Default to false)
|
||||
* @return {Sound} The playing sound object.
|
||||
@@ -200,7 +203,9 @@ Phaser.Sound.prototype = {
|
||||
if (typeof loop == 'undefined') { loop = false; }
|
||||
if (typeof forceRestart == 'undefined') { forceRestart = false; }
|
||||
|
||||
// console.log('play ' + marker + ' position ' + position + ' volume ' + volume + ' loop ' + loop);
|
||||
|
||||
|
||||
console.log('play ' + marker + ' position ' + position + ' volume ' + volume + ' loop ' + loop);
|
||||
|
||||
if (this.isPlaying == true && forceRestart == false && this.override == false)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/**
|
||||
* Phaser - SoundManager
|
||||
*
|
||||
* @class SoundManager
|
||||
* @constructor
|
||||
* @param game {Phaser.Game} reference to the current game instance.
|
||||
*/
|
||||
Phaser.SoundManager = function (game) {
|
||||
|
||||
@@ -225,10 +228,21 @@ Phaser.SoundManager.prototype = {
|
||||
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @method add
|
||||
* @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.
|
||||
*/
|
||||
|
||||
add: function (key, volume, loop) {
|
||||
|
||||
volume = volume || 1;
|
||||
loop = loop || false;
|
||||
if (typeof loop == 'undefined') { loop = false; }
|
||||
|
||||
|
||||
|
||||
var sound = new Phaser.Sound(this.game, key, volume, loop);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user