Jump to content

Search the Community

Showing results for tags 'assetloader'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 6 results

  1. Hello! I've got a question about the v3 assetloader/resourceloader: After loading an asset like such: var loader = PIXI.loader;loader.add('img',"assets/image.jpg");.. can I access the resource with (what I assume is ) the key? Edit: posted it wrong the first time In other words? Is there a way to do this: var sprite = PIXI.Sprite.fromFrame("img");..instead of what I'm doing currently: var sprite = PIXI.Sprite.fromFrame("assets/image.jpg");appreciated as always!
  2. I have a suggestion to add a little convenience to PIXI.AssetLoader's onProgress event: It would be helpful to pass the index of asset that was just loaded (and possibly---for extra convenience---the length of the assetURLs array). The code would go something like: PIXI.AssetLoader.prototype.load = function(){// - var scope = this; // - function onLoad(evt) {// - scope.onAssetLoaded(evt.data.content);// - } this.loadCount = this.assetURLs.length; for (var i=0; i < this.assetURLs.length; i++) { var fileName = this.assetURLs[i]; //first see if we have a data URI scheme.. var fileType = this._getDataType(fileName); //if not, assume it's a file URI if (!fileType) fileType = fileName.split('?').shift().split('.').pop().toLowerCase(); var Constructor = this.loadersByType[fileType]; if(!Constructor) throw new Error(fileType + ' is an unsupported file type'); var loader = new Constructor(fileName, this.crossorigin);// - loader.on('loaded', onLoad);/* + */ this.setLoadHandler(loader, i, this.assetURLs.length ); loader.load(); }};// +PIXI.AssetLoader.prototype.setLoadHandler = function(loader, nth, of){ var scope = this; function onLoad(evt) { scope.onAssetLoaded(evt.data.content, nth, of); } loader.on('loaded', onLoad); }// end +/** * Invoked after each file is loaded * * @method onAssetLoaded * @private */// - PIXI.AssetLoader.prototype.onAssetLoaded = function(loader)/* + */ PIXI.AssetLoader.prototype.onAssetLoaded = function(loader, nth, of){ this.loadCount--;// - this.emit('onProgress', { content: this, loader: loader });/* + */ this.emit('onProgress', { content: this, loader: loader, nth: nth, of: of}); if (this.onProgress) this.onProgress(loader); if (!this.loadCount) { this.emit('onComplete', { content: this }); if(this.onComplete) this.onComplete(); }};...and usage would go something like (example with bootstrap & jquery for ui elements): function init(){ var self = this; var assets = [ // ... ]; var loader = new PIXI.AssetLoader(assets); function onProgress( e ) { var percent = Math.round(e.data.nth / e.data.of) * 100; var value = percent + "%"; // 'pb_loader' is a bootstrap progress bar nested in a modal dialog $('#pb_loader').width(value).text(value); } function onComplete( e ) { // 'myModal' is bootstrap modal dialog $('#myModal').modal('hide'); } loader.on('onProgress', onProgress); loader.on('onComplete', onComplete); $("#myModal").modal('hide'); loader.load();}I have this working on a recent project.
  3. Hi! So here's something that has been bothering me for a while... Can we somehow "unload" textures/texture atlases/assets? I'm working on a game that has multiple levels. At the start of each level, I preload all of the assets the level requires using the AssetLoader. So at the start of the first level I have something like: loader = new PIXI.AssetLoader(["level1_assets.json"]);loader.onComplete = startLevelloader.load();While at the start of the second level I have something like: loader = new PIXI.AssetLoader(["level2_assets.json"]);loader.onComplete = startLevelloader.load();The point is, once the first level is over, I will never again need the texture atlas used to store its assets (resp. "level1_assets.json"). So there's no need for it to linger in my precious GPU memory anymore! Can I somehow dispose of it?
  4. Hello, I'm developing a mobile game in phaser.io (and will wrap it in cocoon.js in future). The game has levels that are unlocked through in-app purchases. For each level, I plan to load the assets (images/sounds etc) through RESTful calls ,for example: https://xyz.com/game/level1/resource/1.jpg At the server level, for each REST call I will check whether the user has access privileges to the asset (ie has the user purchased the level) before serving the asset. Here is my question: Once the user has 'downloaded' a level's assets (using the technique described above) to his/her phone, I want the assets to be available to the user offline. In Phaser's AssetLoader, is the asset cached (in localstorage for ex) for future use? Any other thoughts on this subject?
  5. Hi guys, Quick question: Is there a way to know when the PIXI.AssetLoader class has failed to load a texture? I'm writing a preloader that reports missing assets and just by looking at the AssetLoader source, I can't find a way to react to errors. Thanks!
  6. Hi, I'm having trouble getting to the JSON data exported from a tile based map editing program I would like to use. I would like to know how to access the JSON data that is loaded by asset loader, as this loads the JSON for use as a texture atlas. However the same JSON contains an array with which tiles should go where. I would like to read this but I can't work out how. If I try to load the same JSON again with the PIXI.JsonLoader class it seems to load out of order, not finishing until after the first main update is called causing bad things to happen as the level isn't loaded yet. Is there a way to access the extra JSON data (beyond just creating a SpriteSheet)? Is there a way to delay continuing untill all things have loaded? My project (as it stands) is a mess but resides here: https://dl.dropboxusercontent.com/u/118389529/Site/index.html in non-working form. The relevent bits are: Turning the array contained in JSON to a grid of tiles: https://dl.dropboxusercontent.com/u/118389529/Site/level.js and the init function in index.html Appologies, the code isn't the most elegant at the moment. Many thanks for any help.
  • Create New...