Jump to content

Start Scene Question


Recommended Posts

Hi @enpu

I promise this is the last one for tonight lol :)

Is there a way, I can set the startScene outside of the config? Since I'm using the config file by 3 separate episodes, I either need 3 separate config files (which I don't think is possible), or be able to set the startScene in let's say the html file.

Any ideas on what I can do here?

Link to comment
Share on other sites

@enpu- I got it, I didn't think it would work but I've edited the html files and added the startScene to the episodes main file and yay!

<!DOCTYPE html>
    <meta charset="utf-8">
    <script type="text/javascript" src="src/engine/core.js"></script>
    <script type="text/javascript" src="src/game/config.js"></script>
    <script type="text/javascript" src="src/game/mainR1.js"></script>
    // ***********
    // * ROUND 1 *
    // ***********
    // ***********
    // * PLUGINS *
    // ***********
.body(function() {

game.config.name = 'Game - Round 1';
game.config.storage.id = 'gameR1';
game.config.system.startScene = 'MainR1';

game.createScene('MainR1', {
    init: function() {



Link to comment
Share on other sites

Keep them coming :D

What you are mostly doing in your game.config, is that you are setting class attributes. Those can be set anywhere in your code, not just in game.config

So this code sets startScene attribute in System class to string Test.

game.config = {
    system: {
        startScene: 'Test'

Which is exactly same as this code:

game.System.startScene = 'Test';

game.config is just a more handy way to defined those attributes.

Link to comment
Share on other sites


Sorry I'm not exactly sure what you mean ... I've just made up a silly name that stands for ( main round 1 ), as inside the main I'm loading a bunch of levels.

I also have a mainR2 ( main round 2), in which I load a new set of levels.

They are essentially separate games, and I can also have another one where I include all the levels.

I suppose I could have just called them game1.js, game2.js etc.

Is that what you were referring to?

Link to comment
Share on other sites

@enpu - I need a separate scene just to load different levels.

I'm not actually sure how else this could be done.

My menu scene is global for all 3 games, so the reason I setup these mainR1, mainR2, and mainR3 scenes is to load episode specific content.

For example - mainR2 loads levels 21 - 40

Saying that, I will be putting in a single 'start' button, after the game loads.

Link to comment
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.

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.


  • Recently Browsing   0 members

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