forked from ncase/trust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
3,032 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{"frames": { | ||
|
||
"tournament_peep0000": | ||
{ | ||
"frame": {"x":10,"y":10,"w":79,"h":140}, | ||
"rotated": false, | ||
"trimmed": false, | ||
"spriteSourceSize": {"x":0,"y":0,"w":79,"h":140}, | ||
"sourceSize": {"w":79,"h":140} | ||
}, | ||
"tournament_peep0001": | ||
{ | ||
"frame": {"x":99,"y":10,"w":79,"h":140}, | ||
"rotated": false, | ||
"trimmed": false, | ||
"spriteSourceSize": {"x":0,"y":0,"w":79,"h":140}, | ||
"sourceSize": {"w":79,"h":140} | ||
}, | ||
"tournament_peep0002": | ||
{ | ||
"frame": {"x":188,"y":10,"w":79,"h":140}, | ||
"rotated": false, | ||
"trimmed": false, | ||
"spriteSourceSize": {"x":0,"y":0,"w":79,"h":140}, | ||
"sourceSize": {"w":79,"h":140} | ||
}, | ||
"tournament_peep0003": | ||
{ | ||
"frame": {"x":277,"y":10,"w":79,"h":140}, | ||
"rotated": false, | ||
"trimmed": false, | ||
"spriteSourceSize": {"x":0,"y":0,"w":79,"h":140}, | ||
"sourceSize": {"w":79,"h":140} | ||
}, | ||
"tournament_peep0004": | ||
{ | ||
"frame": {"x":366,"y":10,"w":79,"h":140}, | ||
"rotated": false, | ||
"trimmed": false, | ||
"spriteSourceSize": {"x":0,"y":0,"w":79,"h":140}, | ||
"sourceSize": {"w":79,"h":140} | ||
}, | ||
"tournament_peep0005": | ||
{ | ||
"frame": {"x":10,"y":160,"w":79,"h":140}, | ||
"rotated": false, | ||
"trimmed": false, | ||
"spriteSourceSize": {"x":0,"y":0,"w":79,"h":140}, | ||
"sourceSize": {"w":79,"h":140} | ||
}, | ||
"tournament_peep0006": | ||
{ | ||
"frame": {"x":99,"y":160,"w":79,"h":140}, | ||
"rotated": false, | ||
"trimmed": false, | ||
"spriteSourceSize": {"x":0,"y":0,"w":79,"h":140}, | ||
"sourceSize": {"w":79,"h":140} | ||
}, | ||
"tournament_peep0007": | ||
{ | ||
"frame": {"x":188,"y":160,"w":79,"h":140}, | ||
"rotated": false, | ||
"trimmed": false, | ||
"spriteSourceSize": {"x":0,"y":0,"w":79,"h":140}, | ||
"sourceSize": {"w":79,"h":140} | ||
}}, | ||
"meta": { | ||
"app": "Adobe Animate", | ||
"version": "15.2.0.66", | ||
"image": "tournament_peep.png", | ||
"format": "RGBA8888", | ||
"size": {"w":512,"h":512}, | ||
"scale": "1" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
window.Loader = {}; | ||
|
||
Loader.manifest = {}; | ||
Loader.manifestPreload = {}; // For Preloader | ||
Loader.sounds = {}; | ||
|
||
/*************** | ||
Actually LOAD all the assets in a manifest. Like so: | ||
Loader.loadAssets(Loader.manifest, function(){ | ||
Loader.sceneManager.gotoScene(Loader.START_SCENE); | ||
Loader.startUpdateAndDraw(); | ||
}); | ||
***************/ | ||
Loader.loadAssets = function(manifest, completeCallback, progressCallback){ | ||
|
||
var deferred = Q.defer(); | ||
completeCallback = completeCallback || function(){}; | ||
progressCallback = progressCallback || function(){}; | ||
|
||
// ABSOLUTE NUMBER OF ASSETS! | ||
var _isLoadingImages = 0; | ||
var _isLoadingSounds = 0; | ||
var _totalAssetsLoaded = 0; | ||
var _totalAssetsToLoad = 0; | ||
for(var key in manifest){ | ||
var src = manifest[key]; | ||
|
||
// Loading sounds or images? | ||
if(src.slice(-4)==".mp3") _isLoadingSounds=1; | ||
else _isLoadingImages=1; | ||
|
||
// Loading sprite or image? | ||
if(src.slice(-5)==".json") _totalAssetsToLoad+=2; // Is Sprite. Actually TWO assets. | ||
else _totalAssetsToLoad+=1; | ||
|
||
} | ||
|
||
// When you load an asset | ||
var _onAssetLoad = function(){ | ||
_totalAssetsLoaded++; | ||
if(progressCallback){ | ||
progressCallback(_totalAssetsLoaded/_totalAssetsToLoad); // Callback PROGRESS | ||
} | ||
}; | ||
|
||
// When you load a group | ||
var _groupsToLoad = _isLoadingImages + _isLoadingSounds; | ||
var _onGroupLoaded = function(){ | ||
_groupsToLoad--; | ||
if(_groupsToLoad==0){ | ||
completeCallback(); // DONE. | ||
deferred.resolve(); | ||
} | ||
}; | ||
|
||
// HOWLER - Loading Sounds | ||
var _soundsToLoad = 0; | ||
var _onSoundLoad = function(){ | ||
_soundsToLoad--; | ||
_onAssetLoad(); | ||
if(_soundsToLoad==0) _onGroupLoaded(); | ||
}; | ||
|
||
// PIXI - Loading Images & Sprites (or pass it to Howler) | ||
var loader = PIXI.loader; | ||
var resources = PIXI.loader.resources; | ||
for(var key in manifest){ | ||
|
||
var src = manifest[key]; | ||
|
||
// Is MP3. Leave it to Howler. | ||
if(src.slice(-4)==".mp3"){ | ||
var sound = new Howl({ src:[src] }); | ||
_soundsToLoad++; | ||
sound.once('load', _onSoundLoad); | ||
Loader.sounds[key] = sound; | ||
continue; | ||
} | ||
|
||
// Otherwise, is an image (or json). Leave it to PIXI. | ||
loader.add(key, src); | ||
|
||
} | ||
loader.on('progress', _onAssetLoad); | ||
loader.once('complete', _onGroupLoaded); | ||
loader.load(); | ||
|
||
// Promise! | ||
return deferred.promise; | ||
|
||
}; | ||
|
||
/*************** | ||
Add assets to manifest! Like so: | ||
Loader.addToManifest(Loader.manifest,{ | ||
bg: "sprites/bg.png", | ||
button: "sprites/button/button.json", | ||
[key]: [filepath], | ||
[key]: [filepath], | ||
etc... | ||
}); | ||
***************/ | ||
Loader.addToManifest = function(manifest, keyValues){ | ||
for(var key in keyValues){ | ||
manifest[key] = keyValues[key]; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.