custom load scene
krumza

I read another topics on this theme, but i could not fin what i want

I wish customize loading of assets  on canvas

But how i try  - i cant do that

My logic is :

App = function() {

this.load = function(){
//CREATE TEXT SPRITE AND OBJECT
//ADD TO TEXT OBJECT LISTENER ONUPDATE TO SET TEXT 
//with   wade.getLoadingPercentage ()
}
this.init = function(){
//set custom options
wade.app.real_loading_scene();
}
this.real_loading_scene = function(){
 wade.loadImage
 wade.loadsound
 wade.loadanything
...
 wade.app.gamebody();
}
this.gamebody=function(){
//main logic of game
}
}

I expect - a loading progrees - but txt obj appear with 100%!!! and dont change

If i use wade.preload[Something] i could not use getLoadingPercentage ()

But how calculate custombar when content is mixed? if it only be a images - it be very simple - push in array and etc

I dont know about stadies of initialization wade app. First - loading wade? then onDomload  start App.init() - but why app.load start first? Whith stadies also started?

This seems very much limited developers

Earlyer i do this in phaser - there is preload mechanism:

    game.state.add('Boot', BasicGame.Boot);
    game.state.add('Preloader', BasicGame.Preloader);

and functions 

this.preloadBar = this.add.sprite(300, 400, 'preloaderBar');
//	This sets the preloadBar sprite as a loader sprite.
//	What that does is automatically crop the sprite from 0 to full-width
//	as the files below are loaded in.
this.load.setPreloadSprite(this.preloadBar);

But how it make in WADE i dont understand

Also i always see in console verbose

[.Offscreen-For-WebGL-00000077FB6B0E10]GL ERROR :GL_INVALID_ENUM : GetIntegerv: <- error from previous GL command

that is, I think, first, wade adds a canvas to the page and then using the settings in the app.init I make it 2D?

can do recursive setimeout to grab the values from the kernel wade, but this is wrong I think

 I think that there should be a mechanism to use the load level percentage

thanks in advance

1 Comment
Gio

wade.getLoadingPercentage() tells you how many assets have been loaded vs how many have been requested. Depending on when you call it, you may not get the result that you are expecting.

Also you are right, it only counts requests made via wade.loadImage(), wade.loadAudio(), etc. but NOT wade.preloadImage() etc.

However each one of those functions (both wade.load... and wade.preload...) supports an optional callback, so if you wanted you could do this:

var updateStatus = function()
{
    // update your text sprite and loading bar or whatever you want
};

wade.preloadImage('myImage.png', updateStatus);
wade.preloadScript('myScript.js', updateStatus);

 

Post a reply
Add Attachment
Submit Reply
Login to Reply