I just bought the Personal Edition yesterday to enjoy the full potential of Construct 2 and at the same time Support the great job provided by the guys at Scirra.
I have been fiddling with Families to improve processes that would be happen several times in future when new enemies for example are integrated.
But there are a few things that did not turn the way I thought they would. I have tried to fix them but the more I tried, the worse it became. I spent some time trying to figure out why it wasn't working, but the more I read the Forum / Mnaual, the more I got confused.
This is why I have decided to post my first thread asking for your help!
I tried to regroup different type of monsters in a same family like this:
I created several instance variables and I encounter problems with some of them such as the enemy_type
The idea was that depending on the type of enemy, I would subtract a different amount to the health variable of the Playable Character as shown below:
But the way I did it does not seem to work so I'm a bit confused. For example I have set the Health, which is a family instance variable,to a different value depending on the type of monster (zombie = 100, sprite = 150) and it seems to work fine.
But the enemy_type variable does not work, though I have a condition to subtract a different amount according to the type. But instead it subtracts everything (25 + 50 = 75).
2. Creating new assets
I have attached a cone and a radius to my enemies to detect when the PC is in their Line of Sight or to close to them. To do that, I have made a container such as following:
This works pretty well. But because I wanted to speed up the process when adding new type of enemies, I thought I could use families to do that so I don't create containers every time I add a new enemy:
But when I did it, it did not work as intended. To test if this was working or not, I said to destroy the enemy if the PC is overlapping the cone or the radius. Instead it would destroy all the enemy as if touching one radius was like touching all of them.
Is it because I am not choosing an instance of an enemy and this means this is not possible to do it this way?
3. Instance Variables
So as you can see I'm not sure how to use Family and Family Instance Variables.
Again to detect if the PC was in the LoS of the enemy, I created two family Instance Variables to tell if the enemy is alerted and if he can see the PC as below (this time I'm using containers):
But it's not working as it should. Some of the enemies display the correct icons, some don't... So again I'm not sure how the boolean works for Family Instance Variables (see capx at the bottom of the page). Please let me know if I do something wrong, I would greatly appreciate.
The original version before playing with families was like this, and the LoS worked correctly:
Working Demo here: http://konnee.free.fr/Kill_the_Zombie/
I know it was a bit long and I tried to explain the best I could my problems. This has probably been answered but if it has, I did not get it. I'm probably going to revert to a previous version without famly until I understand how they work.
Thanks again for reading me, and thanks for your help.