Jump to content

Set Storage ID outside config?


Ninjadoodle
 Share

Recommended Posts

Hi @enpu

Sorry about all the questions today, I'm desperately trying to finish my game before the weekend.

Is there a way I can set the Storage ID inside the main file, instead of the config?

I'm trying this but it doesn't seem to work ...

game.config.storage.id = 'gameR1';

Link to comment
Share on other sites

@enpu

This is where I'm trying to put it (I'm trying to use the system so I can have multiple episodes using the same src folder)

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',
    // ***********
    // * PLUGINS *
    // ***********
    'plugin.essentials',
    'plugin.instantgames'
)
.body(function() {

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

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

});

 

Link to comment
Share on other sites

@enpu - Hmmm, I was trying not to define it in the config file, as that file will be used by 3 separate episodes, that's why I'm setting the name in the main file also.

I assume, each episode will need a different storage id, in order to function, otherwise the progress might get overwritten.

Link to comment
Share on other sites

Well you are not overriding anything there. That's just basic JavaScript, you can't set property into object that's undefined.

game.config.storage.id = 'myid'; // Error because storage object is not definfed

game.config.storage = {}; // Define storage object

game.config.storage.id = 'myid'; // Set property id to storage object

 

Link to comment
Share on other sites

Hi @enpu - You underestimate how little I know lol :)

Thank you heaps for explaining this, I really need to pick up a Javascript book that I can read in my spare time, it will help a lot.

I'm getting ok at using Panda, but it's all just learning from examples and docs.

Thanks again for giving me those tips!

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