Using Objects globaly over the whole Project

Get help using Construct 2

Post » Sun Sep 08, 2013 2:41 pm

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
B
7
S
2
G
1
Posts: 6
Reputation: 1,144

Post » Sun Sep 08, 2013 2:47 pm

Maybe you'd like using the dictionary object better, for it can use names(strings) and numbers.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Sep 08, 2013 3:04 pm

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 :-(

B
7
S
2
G
1
Posts: 6
Reputation: 1,144

Post » Sun Sep 08, 2013 3:57 pm

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.)LittleStain2013-09-08 16:02:55
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Sep 08, 2013 6:17 pm



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

Thank you. this solved my problem.
B
7
S
2
G
1
Posts: 6
Reputation: 1,144


Return to How do I....?

Who is online

Users browsing this forum: boybacteria, dop2000, Microbex and 23 guests