Jump to content

Start Scene Question


Ninjadoodle
 Share

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>
<html>
<head>
    <meta charset="utf-8">
    <title>Shurizzle</title>
    <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>
</head>
<body>
</body>
</html>
game.module(
    'game.mainR1'
)
.require(
    'game.menu',
    'game.objects',
    // ***********
    // * ROUND 1 *
    // ***********
    'game.stage01',
    'game.stage02',
    'game.stage03',
    'game.stage04',
    'game.stage05',
    'game.stage06',
    'game.stage07',
    'game.stage08',
    'game.stage09',
    'game.stage10',
    'game.stage11',
    'game.stage12',
    'game.stage13',
    'game.stage14',
    'game.stage15',
    'game.stage16',
    'game.stage17',
    'game.stage18',
    'game.stage19',
    'game.stage20',
    'game.won',
    // ***********
    // * PLUGINS *
    // ***********
    'plugin.essentials',
    'plugin.instantgames'
)
.body(function() {

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

game.createScene('MainR1', {
    init: function() {
        game.system.setScene('Menu');
    }
});

});

 

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

@enpu

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.

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...
 Share

  • Recently Browsing   0 members

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