Hello
I need to have access to a specific objects instance variable when it's put in a Family. But I do not manage to do it.
My problem is like this:
I have two different sprite objects ( it's a bot and a human player ) and have put them in a Family.
The objects has an individual instance variable called (Team).
I need to have access to this variable to determine which team a bot/player is in. I need this so the bots does not attack a bot/player from same team.
I've managed to select the two different objects individually by identify them by their .UID... So I can perform operations on objects independently, for example a bot attacking another bot OR player, even though they are different sprite-objects.
But I need determine on which team a bot/player is in. I need to be able to access the sprite-objects instance variable somehow?
You should know I'm making a Multi-player game. And I have human-players connected on the network and then I have bots.
I have two teams. Blue and Purple.
I could not use the Peer-object ( the human players object ) for the bots. Cause in multi-player it needs to be associated with a connected peer. So I had to create another separate sprite-object for the bots.
I needed the bots be able to target both the other teams human players and the other teams bots.
I make this happen by using the turret-behaviour. Cause then I can get the objects UID that a certain bot has targeted.
This way I can make a Function and perform things to that object - and with the Family option in Construct I can do things in-spite they are different objects.
I cannot have the turret behaviour do everything automatically - cause I have an intricate Finite State Machine working as the AI for the bots. And in certain situations the turret behaviour just don't work.
I know I can use the the turret behaviour it self and add objects to the turret ( Add object to target ). But I can not do this in this situation cause it's very specific conditions and other things in play on how the bots attack ( the enemy )
And it would not work anyway - cause how would the turret know which team he is firing on?
Perhaps I could do something when a bot or player gets created and add that to the turrets targets - but... don't know.
Or make an Array with a teams enemy-players and -bots that contains their UID and SelectedTeam.
...It would be much easier if I just could access the objects instance variable: Team
Anyhow, thanks for reading this far At least I got to evaluate my problem even further when writing this topic.
Thanks!