manupro

how to use require.js dynamicly

Recommended Posts

I'm not using require.js - so I'm not be able to help with require.js updates

 

In a metter of fact Phaser has built in script loader - if you prefer to load scripts dynamically instead of including them in the index.html file
 

Also progress bar will show script progress if you decide to use built in script loader.

 

more info here: http://phaser.io/docs/2.4.4/Phaser.Loader.html#script

simple example:

prealod: {  game.load.script("myScript","myScriptFile.js");}

Share this post


Link to post
Share on other sites
On 23/11/2015 at 5:24 AM, manupro said:

i has realized that the lasted version require.js doesnt work with Phaser editor. today i had tried to download 1.8 version and it work normally :(

You can look into the requirejs template in the Phaser repo, it says:

Quote

 I haven't yet fully decided whether RequireJS is the right way of modularising a Phaser game.

So, as @stauzs said, to load it via phaser loader seems to be the right way to do it. In Phaser Editor there is the asset pack editor that helps to load the assets (including the scripts) in a visual and assisted way.

loadscript.png.6e92c2642a0903763a2ecb5dd

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.