AndreasR's Forum Posts

  • I'll test it

  • Hello. I already made a toggle switch button: https://gyazo.com/d02c0eb9cf1a5700850019549be49f9d (consists of 5 sprites; settings button, blue bar, info, sound & music).

    I've managed to make the blue bar and the other items pop-up after the settings button is clicked.

    However, I am struggling at making it disappear once you re-click again.

    I've tried and didn't work:

    1. Making a global variable (Settings_Clicked) with default value of 0. When the settings button is clicked, the value changes to 1. Afterwards, if the value is 1 and there's a click on the settings button then the rest of the items will be invisible.

    2. Make 2 settings buttons sprites. The primary one (when not clicked) would be visible until it's clicked. Once it's clicked, it will become invisible and the secondary button will appear among with the rest of the items. Once the secondary button is clicked, the button itself and the popup will be hidden and the primary button will be visible again.

    Please advice. I switched from native iOS Swift development and Stencyl to Construct 2 and I am having a bit of hard time understanding its programming mechanics.

    If you attach a capx example I can implement the rest for you ;=)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • JSON Export & Import Encryption — Now for sale in the Scirra Store!

    https://www.scirra.com/store/royalty-free-game-templates/json-export-import-encryption-1191

    <h3>Description</h3><div class="deshr"></div><p>This template includes an import & export function for JSON files (like for SaveGames). The export file has an own CheckSum value to avoid manipulation of the player by editing the export file.</p><p>The import function will recognize changes of the file and the player gets a message that his file was manipulated.</p><h3>Note</h3><div class="deshr"></div><p>However this is not a perfect solution. If the player finds out how the encode function works he will find a way to manipulate the file. But for the most players this will work.</p>

    Use this topic to leave comments, ask questions and talk about JSON Export & Import Encryption

  • What you could do is produce a hash of the values in the JSON file and when it reloads recalculate it and see if the hash still matches. If one of the values is changed without the hash being updated it then won't load.

    Hey,

    thanks for that hint. That sound like a good idea to do that.

    I will try to work something out

  • Hi,

    I want to allow the player to export & import his current savegame, but then the player can easily adjust the JSON file and change for instance the coins earned so far.

    Is there a way to encode the exported JSON file?

    Thanks!

  • Hello wanted to ask about the license package . if I buy this package and use it in my game that I want to sell I pay something extra to make money with my game ? sorry for the question but the translator does not translate well and not leave it entirely clear .

    Hello Jaspe

    what do you mean exactly with 'selling your game'? Do you mean to sell the source code in the scirra store like I do or do you mean to sell it on an Appstore (Google Play)?

    If you want to sell the source code included with my levelselection you need to pay more, but if you want to sell your finished game in an Appstore it is fine with this license, so there is no need for an extra fee.

    Let me know if you have further question

    Regards Andreas

  • I just tried implementing localstorage into my game, and I found an issue that I would like to hear anyone's opinion on.

    I am using an array to store which levels have been cleared, and which is still locked because the previous levels haven't been cleared. The problem I am having is that previously, I would load the array and set each button's animation frame to display the appropriate frame as a sub event to the on start of layout event. This ensured that everything was set up immediately at the start, and the player will not notice it.

    But since LocalStorage can only be used as an event and not sub event, I placed the button animation frame loading events as a sub event for the On item get event, since I thought it made the most sense to put it there and have it load immediately once the value has been retrieved, and also to ensure it only loads once. But the problem is that loading the LocalStorage takes a small but noticeable amount of time. When loading the page, you will notice the button frames changing from default animation frame to the loaded one.

    I was curious what others are doing to counter this loading time to ensure that it isn't noticeable for the player? Is the only option to use an earlier page to load all the values than when you go to the next page, do not reset all global variables but use the earlier loaded variables so you can add it as a sub event to the on start of layout event? Or is there another way to get it to load much faster?

    Hello rekjl

    I'm facing the same problem. I excluded all my LocalStorage function in an extra event sheet called 'es_LocalStorage' and included the event sheet in all event sheets where I need the loading function. When my levelselection screen comes up the player first sees all levels as locked, then when the LocalStorage has been loaded from the LocalStorage the LevelsButton Animation changes to unlocked.

    It's just a little time frame but it is noticable.

    It helps if you use a menu and a levelselection as separate layouts. Then you can fetch the array at the menu, so the values are already available in the levelselection screen. Otherwise I have no idea at the moment to work around this issue.

    Regards Andreas

  • I just got it to work right, i changed the key and variable names and then it worked. Thanks for the help!

    Then an old LocalStorage key with the same name was in your cache of your browser. In this case just purge the cache & cookies in your browser.

    Regards

    Andreas

  • Okay, so i tested it and it worked fine. I got the score to 8,000 just to make sure it works. Then i copied the events into my game, and i tested it, the high score was going up fine as i played, but when the game was over, the high score went to 8,000. I went back to the one you made and i changed the score to 50. Then i tested my game again and the high score went to 50 when the game ended. So the high score was saving the project you made even though it was a whole another project. I even deleted the project and it still did the same thing. Do you know how to fix this? Sorry, i'm still a beginner. Thanks!

    It's hard to say what the problem of your code is, whithout seeing your code.

    I only can check it if you drop me a mail with your project file.

    contacttox@shatter-box.com

    Regards

    Andreas

  • Oh, sorry. Here's the single file. https://www.dropbox.com/s/296as2rrrem6z ... .capx?dl=0

    Thanks <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    You find the fixed version here.

    https://www.dropbox.com/s/ux6u4jecpt05s ... .capx?dl=0

    I altered the way how to update the current score.

    You just forget to 'Set Item '...' to HighScore' to save it. Now it works.

  • dropbox.com/s/xts5c0skst2f5r6/New%20project.caproj

    I am actually using the Local Storage, but i just called it WebStorage. I forgot to add a reset button so if you do, i'm pretty sure it takes the high score back to 0 too.

    Please save as 'Single File' instead of saving as a project. I can't open the uploaded file. It must end with .capx

  • thank you so much AndreasR, it's work!

    Awesome news

  • I'm trying to use this to make a high score system, here's what i have so far.

    On start of layout: Check item "HighScore_Key" exists

    On item "HighScore_Key" exists: Get item "HighScore_Key"

    On item "HighScore_Key" get: Set HighScore to LocalValue.ItemValue

    On item "HighScore_Key" missing: Set item "HighScore_Key" to TotalDistance (which is the current score value)

    Every tick: highscoretext: Set text to HighScore (which is the global variable)

    It starts out like usual but then when the game ends, the number goes right back to 0. Do you know how to fix this?

    Thanks for any help!

    Can you attach a capx example?

  • Welches Problem hast du?

    What problem do you have?

  • There is nothing more to say...this is awesome!

    Great work my friend, keep it up Looking forward to see more of your items on the store!