How do I save a state of a layout?

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • Hi there,

    I just want to ask how do I save the state of a layout.

    I know you might say save save to mysave, but my event sheet codes for more than one layout so how do I do this?

    -------

    I'll tell you how I'm stuck so you can understand better:

    I have a clicker game

    there is an auto click button you can click

    it costs 1000 points to click it

    once its clicked every 1 second 1 point is added

    and 1000 points is deducted from you points

    and then the button vanishes

    when you click a button the code is - go to layout2

    i click it and im at layout2

    now theres another button the code is - go to layout1 (this is the layout with the auto-click button)

    when i return to layout1 the auto click buttons are visible again

    and when you click it again 1000 points is deducted

    but that doesnt effect anything as you already have purchased it

    the player loses 1000 points on nothing

    the player plays another game

    ---------

    remember this code is all in one event sheet

    Hope you could understand my problem

    Thanks in advance

    Radkampfwagen

    Tagged:

  • Hello. You've been on the forum for quite some time now and know a lot.

    You need to stop using the layout saving option and always use saving global variables or dictionaries or arrays. Layout saving is a tool that seems simple and can be useful for beginners, but it becomes even more troublesome when the game becomes more complex and you need to constantly check what to save and what not to save.

    And when using variables, on the contrary, when you start the event sheet, you set the desired states through the saved variables. This method is more flexible and versatile and does not lead to a big complication when the project grows.

    As for your specific question, you can check the layout name at the beginning and proceed accordingly.

  • oh hey there igortyhon

    thanks for your advice

    i have never heard of using arrays or dictionaries before and I don't known what they are for, but as you say that it may help with saving layouts I will have a deeper look.

    But anyway I have come so close to finishing my project but I saw what was happening so I thought I'd look for some advice and you recommend me using arrays and dictionaries, but usually for me to try a new plugin and fully master all the different functions will take some time so is there no way of me being able to finish my project by using no arrays or dictionaries or is that a silly question?

    Anyway could anyone of you send me a link of a tutorial for arrays or dictionaries anytime please?

    Best Regards,

    Radkampfwagen

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • igortyhon

    Sorry for getting back so late, I was busy.

    Thanks a lot for your reply but I tried saving the button visibility through a global variable but it didn't work.

    I tried:

    IF Energy == 1000 AND ButtonAutoClick.onclicked → ButtonAutoClick.visibility set visible AND Subtract 1000 from Energy AND Set EnergyAuto(global var boolean) to True.

    Is EnergyAuto True AND Every 1.0 second → Add to Energy.

    ----------

    I tried this but didn't work.

    Have I made a mistake?

    Should I be using an array for this?

    Regards,

    Radkampfwagen

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)