ArcadEd's Forum Posts

  • Gotcha, I am just creating a function and you can call it whenever you need to fetch the score or update it.

  • I just don't know where to put the code so you can test it. I'm a bit confused by your code, which is why it's making it difficult. I don't know where exactly you want the high score to show up for the player to see.

    I'm sorry, I really trying to help.

  • That's just at the bottom, it won't solve the issue. I'm probably just not explaining myself well enough.

    The flow of the game should be something like this.

    1. Start game, import high score (if one exists) and set it to varHighscore. Set text highscore to varHighscore

    2. Play game, player earns score.

    3. When game is over, check if the score is larger than varHighscore

    If it is, set webstorage high score to SCORE.

    4. Restart layout since the game is now restarting because it's game over. Upon restarting the layout, you go back to step 1.

    Just sticking the code in the bottom of you current code isn't going to solve the problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, I'm having a hard time with your CAPX because there seems to be the same event blocks in several places and I'm not sure why.

    Right now in your game. Where are you wanting me to put the code so you can test it? Which line number?

  • Well there are many places in your code where that same line of code I highlighted is used.

    Basically, Text objects are not updated automatically, so any time you change the variable that you are showing with a text object, you need to set the text to the variable again.

    Or set them to update every tick.

  • How do you know the High Score is staying at 0?

    I don't see anyplace you are updating the high score text with the high score. Does that make sense?

    On start of layout you are setting the text of the HighScore text object to varHighscore.

    But you never update the text box if the highscore is beaten. So it's always showing whatever the high score was when you start the game.

    <img src="http://content.screencast.com/users/ArcadEd/folders/Jing/media/786d58ad-4a14-46a2-b2f8-1a5df91e2f1f/2013-05-28_1634.png" border="0" />

  • There are a few ways.

    1. Use CocoonJS

    2. Use AppMobi

    3. Use a wrapper like Phonegap and compile the project in Eclipse

    to name a few.

  • Yeah, it would be great to be able to subscribe to threads.

  • Where in your code are you saving the high score to web storage? I don't see it in the snippet you posted.

    Do you mind posting up a CAPX?

  • As far as I know, if you are building the app with CocoonJS, there is no way to then go into Eclipse and edit it.

  • What I mean is, right now your code is never setting a highscore to the webstorage, so naturally it's 0.

    Maybe this will help if you haven't seen it yet.

              

    Subscribe to Construct videos now
  • Ok, the only place you are setting the high score is on the start of layout. Since varHighScore is 0 at that point, it setting 0 to the webstorage.

    Try creating another Keyboard event to give yourself a score to play around with it. Or 2 keys to give different scores for testing.

  • how do you have it setup to clear the storage? Can you show the code snippet of where you are clearing it?

  • <img src="http://content.screencast.com/users/ArcadEd/folders/Jing/media/bff0c44f-5e9d-4275-8928-51171498acf8/2013-05-27_1952.png" border="0" />

    CountOnes is a global variable.

    I just used the touch event to trigger the for each event, obviously you would use something different.

    You can also just change the current value to 2 to count up the 2s.

  • You can just create an event like On Key Press (pick a key) and for the action, clear local storage or clear session storage.

    Just remove it before you finish up your game.