Using Objects globaly over the whole Project

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello,

    i already read many posts but everything i read there seems to not work in my case. So i have to write my own Thread now.

    actually i am creating a small card game.

    it works fine, the gamelogic is working as intended.

    but one feature is to collect cards and so i not just have the main menu and the gameplay, i also have something like a catalog, where i want to manage the cards.

    at this moment i am creating the cards when the gameplay starts, but this is where the problem starts.

    i would like to move the creation of the cards to the mainmenu as there are 100 Cards and i only want to play with 20. So i said to myself:

    "Okay you create the cards on the mainpage, place the informations in an array and when the gameplay starts, you pick the cards from the array"

    But this doesnt seems to work. i allready read something about making a own sheet for this object and include it in the layouts where its needed, but this doesnt help me, at the point where i want to know which cards i want to use in the game.

    for example:

    • game loads > cards getting loaded
    • click on catalog > cards are shown in a album and i can manage them and select 20 cards i want to use in the game.
    • click back to mainmenu
    • click on start game > game starts and still knows which cards i selected in the catalog to and i can grab them.

    i know that i can not store objects directly in arrays (just values, which sucks, but okay) but i can store the UID and so i could gather the card in the game over the uid.

    but how can i do that?

    Greetings

    Tepoo

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe you'd like using the dictionary object better, for it can use names(strings) and numbers.

  • as there is a possibility to modify the cards i not only need the reference.

    the dictionary is working nice as a reference storage, but how can i say that the cards who are created in the mainmenu, also have to exist in the gameplay and catalog? and not just the same object, i realy need the same instance, i dont find a way for it :-(

  • It could just be me, but it isn't very clear what your problem is.

    On card selected add key to dictionary object.

    on start of game if key exists set card one to blablabla.

    Should work right?

    Just make sure to set everything that should be global to global in properties.

    (maybe this was actually what you meant in the first place, haha, if you select an object in the properties window under the uid there's the option to set it to global.)

  • <img src="http://images2.wikia.nocookie.net/__cb20130712135013/glee/images/thumb/4/4b/POlar_facepalm.jpg/640px-POlar_facepalm.jpg" border="0" />

    Oh my god... i realy checked everything from objects, to behaviours... but didnt saw this propertie.....

    Thank you. this solved my problem.

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