-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request] Read a "folder" of resources #109
Comments
Is this something you can't accomplish with the CACHE object? http://doc.gameclosure.com/api/utilities.html#cache You can use that to read files. |
It sort of ties in to #108. If the non-coders can just add files to |
Rereading these now I'm at work, doesn't the CACHE object only read JSON files? I was intending to use it for sounds and images. |
I see. So you want to use sounds and images in your game without explicitly referencing them in your code. You can do this with images using the SpriteView, which allows you to load up a whole collection of animations using a prefix. For instance: var jerry = new SpriteView({ That SpriteView will find all the images that start with 'resources/images/jerry'. These may include: 'resources/images/jerry-run-01.png' Etc. It turns them into animations that you can trigger like this: jerry.startAnimation('complain'); So your artists can drop new images into resources/images, and they'll end up in the game without you having to know/care about it. No such mechanism exists for sounds. What would this API look like? The AudioManager initialization options include "files", an object mapping sound keys to definition objects. Perhaps we could add a new flag to this sound definition object, something like "autoFind". If this flag is set to true, maybe the AudioManager autopopulates the "sources" object with any sound file in the specified directory that matches "[sound_key]_[number].[sound_extension]". We probably won't have time to look into something like this in the near future. If you want this feature, it may require some digging. We can give you some pointers on IRC (#gameclosure in freenode). Good luck, and don't forget to submit a pull request. |
Regarding images, it's not for animations, just static items (fruits in a picnic basket is the current instance, as an example). So there's a folder For sounds, something like what you described would seem a decent startpoint. I'm a little busy with work currently, but might be able to have a go at it in the next couple of weeks. I'll see if I can't catch catid or marbar online there. |
Did you come up with a solution for this? |
Afraid not - from what I recall, initial investigation suggested it was beyond the scope of just a plugin, so we decided to just stick with including the relevant number in the json. |
Roughly what it says. In a similar vein to the sound one, is there a way the devkit could allow us to read a folder of resources, so additional items can be added just to the folder with the code looping over its contents?
The text was updated successfully, but these errors were encountered: