oldandgrey's Recent Forum Activity

  • I assume you mean to store it so that it can be retrieved the next time you play the game. If so then you need to use webstorage (depreciated) or localstorage. Suggest you look at the HiScore thread half a page below this for a very good example of how to do this.

  • Thanks LittleStain, nice clear example. Will file it away for the future. Interesting the use of add/ subtract values to KeyboardInput rather than simply setting the value to allow you to detect multiple keypresses.

  • Some sample code from one of my applications that does exactly this :-

    // Reformat hiscores into C2 compatible format
    $cnt = 1;
    $cnt = count($hiscores);
    for ($i = 0; $i < $cnt; $i++) {
          $scores[$i][0][0] = $hiscores [$i];
    }
    
    $content->c2array = "true";
    $content->data = $scores;
    $content->size[0] = $cnt;
    $content->size[1] = 1;
    $content->size[2] = 1;
    
    $encoded_content = json_encode($content);
    [/code:2sx2hb05]
    
    I've tried to remove any code specific to my application.
  • Yes also having problems with iPad sound. If the music plays then the sound effects don't, but everything works on other platforms. Must try the preload to see if it helps. Thanks.

  • Unfortunately when starting, a pageful of code like the above can be daunting. However it is a very good example of how to use local storage.

    Lines 1-4 - Retrieve High score from local storage

    Lines 5-6 - Simulate game increasing your score

    Lines 7-9 - Save High score to local storage

    Lines 10-12 - Not applicaple to the query

    Local storage is very useful and imo even more so when combined with a dictionary object to avoid racing issues for multiple variables.

  • Hi Mitova,

    Like the simple graphics, and general look of the game. Just need to add a running score/ timer, some sound, more spaceships and some effects but those are undoubtedly on your list already. Think you're going in the right direction with functions and grouping similar objects.

    As someone who is also at the early stages of learning you're lookin' good so far and I'm looking forward to seeing the final product.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks Iolva appreciate the offer. Thought I had managed to get the link posted but unfortunately not. It would also seem that I cannot send any pm's either. Think I will just revert to lurking lol.

  • Ok, lost track of the number of times I've tried to post what was to be my first post.

    For those like myself that need a little more help re loading and saving from local storage here (I hope) is a simple example capx.

    mega.co.nz

  • Hi,

    Just beginning to learn Construct 2. Started as part of a project to try and integrate HTML5 games with a crypto currency called coin2. Needed to see what was involved in writing a game, so here I am.

  • Deleted - posted in wrong place

oldandgrey's avatar

oldandgrey

Member since 5 Sep, 2014

None one is following oldandgrey yet!

Connect with oldandgrey

Trophy Case

  • 10-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies