0 Favourites

hidden object game

This forum is currently in read-only mode.
  • I decieded to make a hidden object game at first. I think it will not be that hard and it will be good start.

    I have a first problem. I made a private variable for items and if I click on item, then I want to add to score 10 points. But if I click last item score jumps to 0. I am adding a cap file, any ideas what can I have wrong?

  • You are adding 10 to objects private variable, when you press on all three score will be equal 0, because there's no objects on layout with score variable.

    Make new global variable "global score" and after pressing on object add 10 to that global variable - not private.

  • thanks, please how can I make variable global?

    and another thing appears strange to me now. when I copy layout, it copy only layout, but without events. is it possible to copy whole layout with all events?

  • [quote=]thanks, please how can I make variable global?

    In Project bar - where you have list of layouts, event sheets, objects... there's a "Global Variable" - right click on that and select "Add global variable"

    [quote=]and another thing appears strange to me now. when I copy layout, it copy only layout, but without events. is it possible to copy whole layout with all events?

    Don't know :D

    It's a good habbit to make seperate event sheetsand then just include one you need to your layout event sheet.

  • shinkan: thank you so much, it really works now :)

    only thing which I miss now is that when I finish layout (level) I want to add score to some global score on main menu. but it seems again as a work for an array, which i still dont understand...

    here is almost finished cap for hidden object game:

    when I will be able to make all what I need to have in game, then I will start to make finally some graphics :)

  • Can some help me, please?

    Im still stuck at the same problem :(

    when I go from one level to another I have a global variable and adding score to "global score". But when I exit game and then start again and click in main menu on score, it shows value- "0" . How can I save this information, so when I start game again it shows "score"...

    I know- array, hashtable, ini ... - I tried to use them many times, many hours and I cant figure out how to use this ...

  • Start with adding array object to your game.

    Then set so every now and then an event trigers (when moving betwen levels or at exiting the game)

    array -> set value at X

    array -> save AppPath & "[insert_file_name_here]"

    Do the same at the start of the game but just the load:

    array load AppPath & "[insert_file_name_here]"

    do make you understand arrays (which sounds scary) lemme compare it to Excel sheet. So you have rows and colums. The only diffrence is that array can be rows only, or rows and columns only, or rows and columns + additional 3rd dimension. like X, Y and Z axis.

    And you store your information inside. You just have to remember what is where. Under what coordinats

    for example. if i want to save a value of the score you can use just 1 dimensional array with X axis only. And so you would:

    Set array value (X1, Y1) -> 10

    and then at "save point" you do

    Array save -> AppPath & "Array name"

    This will save your array file in the main exe folder. The file name will be whatever you typed in "Array name". Ofcourse you can also add some extension name to it like "ArrayName.rar". And why it would benefit you read here

    http://www.scirra.com/tutorials/39/how-to-secure-your-game-assets

  • fixed

    Your post didn't show for me...

    Here's the fixed file useing INI object

    And one more thing. System actions save and load don't work properly and better don't use them.

  • I dont know what is wrong with me, but I cant still get it working :(

    shinkan: when I load your fixed file, it still does not work to me and I dont know why :(

    the_funny_guy: I tried to make exactly how you told me and I dont know why it does not work, here is cap:(

    I know internal save/load system is not the best, but I need to use it until I finally learn how to use array or ini

    The thing I want to achieve here is that at the end of the level (now there are 2 levels in this cap) the score will add to "global score" and whenever I start application I want to have in menu under "score" final count of score...

  • What do you mean it's not working?

    I just opened it -> clicked score -> shows me score = 0 -> Run the game -> get 30 points and press X to close.

    Run again -> clicked od score in menu -> shows me score = 30.

  • shinkan: very sorry, I now see the ini file is saved only if I click X on game... I exited whole application first. thanks it works now :) it is fantastic and looks not too hard, hope I will be able to use it alone soon. again thank you much!

  • heh, there's no need to sorry, i should mention that later I modify your events a bit.

    Glad you finnaly make it work :)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • oh. kick the squer branclets [ and ]

    just write "something" not "[something]"

  • thanks :)

    about ini, I finally think I understand how it works :)

    here is small sample of save system (for save layout) with ini files...

    this ini system is fantastic, thanks again for help with it :)

  • well, I thought I can do everything I need now, but I have a problem again. I want on start of each level (layout) to make an "autosave". And if I start again game and load autosave I want to start last level (restarted - from beginning) and also with last score in it...

    I made autosave through ini - it saves layout at start and when I play game again it loads first layout again... I cant find where is error.

    can someone look at it and tell me what I am doing wrong again?

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