you got to give a player an amount of fictional objects inside a class of objects?
For example, i want to give the the player an item he can achieve in a sub-game, and can only use it in another (sub-)menu.
So the player itself needs a family of objects he can achieve, with a specific amount.
I cant find a good solution for this, and dont want to define every catchable object single as an instance variable.
hope you understand my problem, any ideas are welcome :)
Do you mean mini games within 1 game? Or 1 game that could save information and be loaded in a seperate one?
If you mean mini games in 1 game then you could use global variables to keep track of any stats you would like and apply them to other mini games as you would like.
thanks for your answer...yes i mean minigames, which are available in situation during the main game.
i would also go the other way, that an object is "linked" to a player in a specific amount. but i dont know how to solute this in c2, since every object needs to be something like a sprite etc.
But i guess you need a better example. Maybe a player (object) made a subgame, and catched some TV's for later sell. But he does not sell, he joins the subgame twice and this time he got some prized Handys in his "bag". When he walks to the dealer, he can sell both, or pieces of these objects.
So, All this stuff you can earn should have its own class (family). So the question is, how to define that the player has an amount of a selected item inside the class or family?
Could this be currently made in c2?
You mean like an inventory?
You could use a "Dictionary" object to store what objects you have.
For example say you have a game where you collect bananas among other things and like you said you don't want to add an instance variable per object type. When you collect a banana add it with an action like this:
Dictionary: Add key "bananas" with value self.Get("bananas")+1
thanks for your suggestion rojohound :)
i got multiple players, it is a round based game. can i assign an array or a dictionary object directly to a player object?
You can create multiple instances of the array and dictionary objects. If you save the uid of a dictionary instance to a sprite instance variable you can use that to associate the objects together and pick them with events.
Develop games in your browser. Powerful, performant & highly capable.
ok, i think i am gonna use this solution :)