How do I exclude a certain object when there are other objects that are the same sprite and group?

How do I…

A clear and concise description of what you are trying to do.
So I’ve been trying to create a basic enemy selection system, a lot like the Mario and Luigi RPG’s, but there doesn’t seem to be an option to do so without being bloated.
I created an arrow and a detection range as 2 separate sprites and made a group to include both of them. When a key is pressed, the detection range changes sprites to correspond to the direction (and I did add specific collision boxes for each of them), and then the sprites (as a group) WOULD move to the enemy that collided with the detection range’s collision box. However, because I have the target of pathfinding set to “enemies”, which is a group for all the enemies that exist, it just tracks the enemy closest to it, which is the one that’s already been moved to. This is even more exacerbated by the fact that there can be multiple of the exact same enemy. So, is there a way to make objects move (with the pathfinding behavior specifically) to the object(s) that it is colliding with ?
Also, is there an easy way to give multiple of the same object “clones” each different identities, if that makes sense.
Again, I could probably do it with my knowledge right now, but it would probably lead to some performance issues in the long, since I would be creating a slightly edited version for every enemy encounter possible.

Hey there! Sorry for the late reply.

Have you found a good way of making what you wanted?

If not, i can kinda help you out.
Im thinking of making something like this for one of my games too, but i havent made it yet so not 100% on the details…

You can make a difference between the “clones” of your enemies by giving them an ID.

To do this, make a global number variable, call it something like “EnemyID” and leave it at “0”,

Then at the start of the scene, do something like…
Condition
At the beginning of the scene

Action
Change global number variable “EnemyID” “add” “1”
Change object number variable “EnemyNr” of “Enemies” “set to” “EnemyID”

this will make it so that every “Enemy” will have a different “ID”.
If this dosent work, try making the events on a “for each object” and on “object” change it to “Enemies”

From there we can try some sort of logic like…

  • If the Enemies are within a certain range and a button is pressed an arrouw is created at the position of the enemy.
  • When the Arrow colides with the enemy, change an object variable of the Arrow and set it to the same as the “EnemyNr” variable of the Enemy.
  • Then we can try to make something like, if the key “Up” is pressed, change the arrow position to the enemy with a “EnemyNr” higher than the arrow, or “Down” and change it to an enemy with a number lower.
  • When the arrow colides with the new selected enemy, we change the arrows object variable to now match the new enemies “EnemyNr”

I think this would be doable.

RPG systeam always take a great deal of logic to make happen, so get used to stuff like this :smiley: