linked in Groups and Logic


I have set up an AI for a mosquito. The mosquito is linked in as a group to the level file.
Now I have duplicated them so that I have a few mosquitos in the level.

But it seems that the logic is only working right by the first duplicated group.

For attacking I used to calculate the distance between the mosquito and the player like this:

AttackDist = Mosquito.getDistanceTo(Char)

Now I found out that it calculates only the distance for first duplicated group and uses this also for the others.

So is that not possible to get the distance for all duplicated mosquitos?

Thanks for any help in advance

Extreme vaporizer review

what type of game?
like is it a swarm of mosquitoes or what i gtg bbl and i might have some help bb

It is an adventure game.
Game Info site:
Yeah it is like a swarm. But this I need also for my other enemies such as spiders, snake and so on.


How did you get the reference to Mosquito? If you got it via getCurrentScene.objects, it will just pick the first object with the appropriate name that it sees.

You want to be using GameLogic.getCurrentController().owner to get the proper object reference.

It’s hard to be very helpful without at least seeing the rest of the script, if not the file itself.

Hey thanks for that hint. I will try that out.

Here is the file if you would like to see.


Aha I do not need to get the mosquito object. Just write the owner which is Obj.

That script I wrote at the beginning of learning python so that time I did not know that. But still learning python.

So it should look like that:

AttackDist = Obj.getDistanceTo(Char)

And it works.

Ship Sale