AllanR's Forum Posts

  • jhonathan Ibanez, as far as I know you can only up-vote comments on tutorials and places like the official blogs, and download pages. Not in the forums.

  • rexrainbow, well, I played around with your version a little more.

    I took the dictionary out of the sprite. Made the Sprite global, made the dictionary global, put the dictionary back in the sprite, re-ran the project, and then the dictionary appears to be persistent now...

    (setting the dictionary global while it was in the sprite did not work)

  • Yeah, I just saw in yours that the dictionary is destroyed when it is in the containing sprite...

  • rexrainbow, I made a little test capx before I posted... and it looked like they both were persistent. I am just about to look at yours...

    http://www.rieperts.com/games/forum/ArrayPersist.capx

  • vagaev, wow! that is outstanding information! I have done some tests here and there to try to figure all that out, but never seemed to get just the right settings.

    You should copy and paste all the text you posted and make it into a tutorial, with a sample capx file - with enough objects so that people can see exactly what gets cut off or not on various screen ratios!

    I have looked for tutorials on this and never found one that spells it out so clearly! Thanks!

  • Aren't the Array and Dictionary objects already persistent?

  • well, it worked for me... and I am #1751 on the list. I better get to work on moving that up...

    Hey, just posting this message bumped me all the way up to #1748

    Maybe I should go make a few thousand more pointless posts... (just kidding).

  • Yes, as long as each request has a unique tag, the LastData will be correct within the completion event. I have passed lots of data back and forth and never had a problem.

  • sotak, first of all, I would put most of the code in the collision section in a function so you don't have to duplicate the code so many times...

    Also, you have several problems with webstorage. You are saving the text "Score" instead of the value of the Score variable, and you don't need to do that every time the score changes. Webstorage is for saving data when you close the game after you are done playing. Then the next time you open the game you can load the data back in (to keep a local all time high score for example). But you are resetting the webstorage "Highscore" field at the start of the game, in event 2, which would wide out the previous high score (if it was being correctly saved). And, on top of that, there are a couple places (events 3 and 7) where you do not have Highscore in quotes - so Construct2 will use the value of the Highscore global variable of zero, rather than the text key "Highscore".

    Now, for the main problem you asked about at the end of the game, it looks like you are setting the Highscore text object to be visible, but I don't see any place where you give it a value.

    So, the main thing to keep straight in your head is that you have three completely separate things here: 1) the global variable Highscore that keeps track of the highest score achieved by the play while the game is running. 2) the Highscore text object that can be used to show that high score to the player on the screen. And 3) the Webstorage "Highscore" field that can permanently save the high score on the players computer hard drive when they quit the game.

    The main flow should go something like this: Load in Highscore from Webstorage if it exists, otherwise create it and set it to zero. Set score to zero. Play game. You have the right idea in event 7, where you add 1 to Score. (but you can take out the Webstorage line there)

    Then when the game ends you want to check if Score > Highscore, then set Highscore = Score, and save it to webstorage. Then set the text object Highscore to something like "Your score="&Score&", High Score="&Highscore... then button to restart the game...

  • vtrix, I am not sure exactly what you mean... I just tried half a dozen ways of using a string variables with functions and they all worked.

    I passed a string variable in as a parameter, accessed a global string variable, and even called a function by assigning the name of the function I wanted to call in a string variable.

    (I am running version 161)

  • I only discovered Construct 2 a couple months ago, and so far I have seen licenses go on sale twice. So, you probably wont have to wait too long for the next sale...

    There is no functional difference between the personal and business versions. You only need the business version when you start to make a lot of money - and then it shouldn't be a problem! :)

    When licenses go on sale, the upgrade from personal to business license has also gone on sale too, so there really is no need to start out with a business license first if money it tight.

  • I tried your capx, removed the physics, and tested it out - and the top stair seemed to work fine for me...

  • That all sounds very helpful! can't wait to see it! :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, just have the button start the "trigger event" and a timer, when the timer is up, call the next layout.

  • on event line 22 you set Solid to Disabled, but I don't understand why you would need to do that.

    And you never set it back to Enabled, so that may be the problem...