Phaser. AudioSprite

new AudioSprite(game, key)

Audio Sprites are a combination of audio files and a JSON configuration. The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite

Parameters:
Name Type Description
game Phaser.Game

Reference to the current game instance.

key string

Asset key for the sound.

Source - sound/AudioSprite.js, line 17

Members

autoplay :boolean

Is a sound set to autoplay or not?

Source - sound/AudioSprite.js, line 48

autoplayKey :string

If a sound is set to auto play, this holds the marker key of it.

Source - sound/AudioSprite.js, line 41

config :object

JSON audio atlas object.

Source - sound/AudioSprite.js, line 35

game :Phaser.Game

A reference to the currently running Game.

Source - sound/AudioSprite.js, line 23

key :string

Asset key for the Audio Sprite.

Source - sound/AudioSprite.js, line 29

sounds :object

An object containing the Phaser.Sound objects for the Audio Sprite.

Source - sound/AudioSprite.js, line 54

Methods

get(marker) → {Phaser.Sound}

Get a sound with the given name.

Parameters:
Name Type Description
marker string

The name of sound to get.

Returns:

The sound instance.

Source - sound/AudioSprite.js, line 115

play(marker, volume) → {Phaser.Sound}

Play a sound with the given name.

Parameters:
Name Type Argument Default Description
marker string <optional>

The name of sound to play

volume number <optional>
1

Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified).

Returns:

This sound instance.

Source - sound/AudioSprite.js, line 77

stop(marker)

Stop a sound with the given name.

Parameters:
Name Type Argument Default Description
marker string <optional>
''

The name of sound to stop. If none is given it will stop all sounds in the audio sprite.

Source - sound/AudioSprite.js, line 93
Phaser Copyright © 2012-2015 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.2 on Thu Feb 18 2016 14:40:58 GMT+0000 (GMT Standard Time) using the DocStrap template.

快捷菜单

注意:只有登录才能全文翻译,每个新用户赠送300会员币。
赚取方法:文章评论+1000,分享网站截图给站长+3000,另充10元+100万会员币
支持一下记得截图给站长!

VIP限时免费阅读!登录可得1万币尽情中文阅读!


记得CTRL+D收藏!
站长微信:
支持自学php网
如有问题,记得强刷一下.

  • autoplay :boolean - 属性
  • autoplayKey :string - 属性
  • config :object - 属性
  • game :Phaser.Game - 属性
  • key :string - 属性
  • sounds :object - 属性
  • get(marker) → {Phaser.Sound} - 方法
  • play(marker, volume) → {Phaser.Sound} - 方法
  • stop(marker) - 方法