Have clones point to other clones
-
This would be useful for ai clones to attack other ai clones directly.
-
Maybe you can use a table to store positions of all clones, and then you can use the “point towards x y” block to turn a sprite towards any of those positions?
-
@info-creaticode The fact that the clones are bots, and there is multiple bots (clones) on both teams, I am afraid that it might lag because the table is updating so frequently. Even if I make a sprite for a detection zone to limit how far each bot can track each other, I doubt that will mitigate it should lag ever occur.
-
Sure, a new dedicated block would be more efficient. How about a new motion block like this?
point towards sprite [SPRITENAME] with clone ID [ID]
-
Note that most likely you will still need to know each enemy clone’s position and decide which of your clone will target which enemy clone based on positioning and power. You don’t want to hardcode which of your clone target which enemy clone, right?
-
@info-creaticode I want it where they will target the closest clone within a set distance of itself.
-
What if there is no clone within the distance limit? What if multiple of your clones will target the same enemy clone?
This is becoming very specific to your game, so it is not suitable for a new block, which is meant to be much more generic.
-
@info-creaticode For now, the ai is set to where they just fire in random directions In front of themselves. The enemy ai does the same, but targets the player if the player is close enough to them. I just published the first version of the game, so you can go check it out.
For your question: They would just shoot in random directions and occasionally move.
-
Thanks for sharing. It will be an interesting challenge to remix your game and add smarter logic for the clones based on enemy clone positions. Let’s see if there are any volunteers…
-
@sirbots I can try, and updating to a table I believe does slightly lag, I have a project that I recreated here that uses this method, I have recreated it in 3 different places as a sort of benchmark (code.org, here, nad codeacademy) and I’m pretty sure I got decent fps at like 30 clones on creaticode, I’m fairly certain that 10-15 was no problem, though I can try to find the project (the project does have similar logic to this, checks distance from every other clone, then checks some values per clone to decide what to do)