Jump to content

allocating Loader doesn't work


shvalb
 Share

Recommended Posts

Hi,

 

I'm brand new to Phaser and I saw that you can use the Phaser.Loader in 2 ways:

 

1. via the 'game' object as follow:

game.load.pack(...);game.load.onLoadStart.add(loadStart, this);

Which works great!

 

 

2. by allocating Loader object as follow:

preloader = new Phaser.Loader(game);preloader.pack(...);preloader.onLoadStart.add(loadStart, this);

Doesn't work this way!

 

 

What am I missing in the 2nd option that prevents this code from working?

 

Thank you :-)

 

Link to comment
Share on other sites

When Loader is instantiated this way, it doesn't call the Callback methods.

 

I was trying to allocate a Loader so I can pass it as individual object into different Classes via CTOR.

 

Just something I got used to do when working with other frameworks.

 

But, no matter the reason it should work - else, why it has a CTOR that gets 'game' as a parameter?!?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...