Thank you for your help and clarification. Here are the results illustrated by the next following images below. The idea that dop2000 proposed works. Now the problem with this idea is its usability.
By usability, meaning that if we were to extend this idea to designing a unit combat system a new problem will arise. To discuss this problem I will first describe the new changes made to the project.
The “Blue_Unit” now has an additional Behaviour; Turret and the “Red_Unit” has a new Instance Variable called “Targetted” of Type Number. A new Sprite has been added called “Bullet” with a single Behavior Bullet. The following image below illustrates the new game scenario setup.
Now this problem is similar as to that problem first discussed in this thread, which was how to have a single unit that is selected AND has LOS to a specific object, have that specific object change its animation.
The problem is of course unit combat system design. What I want to be able to do is,
If a “Blue_Unit” is NOT moving AND has LOS to “Red_Unit”
THEN
Set the value of the “Red_Unit” Targeted to 1 AND add this “Red_Unit” as target.
If a “Blue_Unit” is moving OR (has NOT LOS to “Red_Unit” AND “Blue_Unit” is NOT moving)
THEN
Set the value of the “Red_Unit” Targeted to 1 AND this “Red_Unit” as target.
If “Blue_Unit” is Shooting
THEN
Spawn a Bullet
The following image below illustrates a simple example of this combat system.
Currently with this, nothing happens that is the “Blue_Unit” does not Spawn a Bullet. Overall why am I asking this and what I am getting arises from this story where I have had tried a more complicated variation of this combat system.
Initially I had a family (Units_A) where this family contained,
“Blue_Unit_0”, “Blue_Unit_1”, “Blue_Unit_2”, … “Blue_Unit_n” , where n is a positive integer.
“Red_Unit_0”, “Red_Unit_1”, “Red_Unit_2”, … “Red_Unit_n” , where n is a positive integer.
And so on with different colors and numbers.
This family (Units_A) would contain the following instance variables,
Unit_ID of type Number
Health of type Number
Damage of type Number
…
And so on with different instance variables that could be change for each individual unit in this family.
This family (Units_A) would contain the following behaviors,
Pathfinding, LineOfSight, Turret
Moving the desired units given a set of player restrictions on the screen was easy to setup as the conditions were simple. Once a combat system was required to be implemented this is where problems arise. The main problem was family member identification.
With family member identification the problem is how do you know if for example “Blue_Unit_0” has LOS to a current “Red_Unit_1” and not to another units relating to its family. The solution for this may be quite simple that is create a copy of that family call is Units_B.
To follow along what I am describing follow the following link attached below to a game that I am currently designing where there is an attached Template of the game.
construct.net/en/free-online-games/lifetime-human-war-4211/play
But creating another copy of the original family presents again a similar problem of unit identification. In some cases this idea works but in this thread not. I have followed these discussion forums links to which are attached below.
construct.net/en/tutorials/understanding-picking-respect-333
construct.net/en/forum/construct-2/how-do-i-18/recognizing-individuals-47138
These threads and discussion discuss issues similar to this thread which brought me to nowhere. As such the next thing I tried is what I am doing now that is create a skeleton structure which will take on future assigned values. That is replacing the function of family with one sprite. Here I am trying to get a simple combat system of units to work between one another.
Again thank you for reading this thread and any future help.