rblopes / generator-phaser-plus

[🛑 DISCONTINUED] It has been a long journey but development of `generator-phaser-plus` is now over. I recommend you have a look and fork `yandeu/phaser-project-template` instead.
https://github.com/yandeu/phaser-project-template
MIT License
144 stars 14 forks source link

audio assets #1

Closed amex4152 closed 9 years ago

amex4152 commented 9 years ago

Hello there,

It seems that the audio assets are not loading correctly, I tried ogg and mp3 files without success:

In the assets.js file:

// - Music and Sound effects ------------------------------------------------ 'audio': [ { key: 'totta', type: 'audio', url: 'totta.ogg' } ]

Gives error:

Uncaught TypeError: Cannot read property 'length' of undefined

I didn't find any email to check first if this is really an issue or an error from my part...

Regards

rblopes commented 9 years ago

Hi there.

In doubt, always refer to the example assetPack.json, included with Phaser — its in resources/Asset Pack JSON Format directory, inside the Phaser package.

Anyway, to declare any new audio asset to use in your game, do as below:

{
  key: 'totta',
  type: 'audio',
  urls: [ 'totta.ogg' ]
}

I should have included an commented example to that file, should do it in a next release.

(Edit: Oh, I got distracted and closed the issue by accident, sorry!)

amex4152 commented 9 years ago

Thank you!

It worked, I wrongly assumed that the parameter was exactly like the other 2, using "url" instead of "urls", and yes, a commented example would be wonderful.

Now, Should I close this issue or leave it open until next release ? (Sorry, I'm new to GitHub)

rblopes commented 9 years ago

Don't worry. I'll close the issue later with a commit.