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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.