precache.js 581 B

123456789101112131415161718192021222324
  1. var resources = {
  2. "Sprites/space_background.png" : "Texture2D",
  3. "Music/battle.ogg" : "Sound",
  4. "Sounds/boom0.wav" : "Sound",
  5. "Sounds/boom1.wav" : "Sound",
  6. "Sounds/laser01.wav" : "Sound",
  7. "Sounds/laser02.wav" : "Sound",
  8. "Sprites/explosions_sheet.xml" : "SpriteSheet2D"
  9. };
  10. // precache resources so they are ready to go
  11. exports.precache = function(verbose) {
  12. var game = Atomic.game;
  13. Object.keys(resources).forEach(function(key) {
  14. game.cache.getResource(resources[key], key);
  15. if (verbose)
  16. print("Precaching: ", resources[key], " ", key);
  17. });
  18. };