Stuck trying to create an infection(COVID) game mechanic

I am trying to figure out how to create an infection mechanic. Basically I am the covid virus and I can jump on people’s heads and infect them, and when they are infected they then infect each other if they come in contact with one another.

I have a character covid object and man object.

The man object has a variable called infected=no; and two animations walk, and sick.

What I was hoping to do is that when I collide with the man object, his infected becomes yes, and then if he is infected his animation changes to the sick animation. Then if an infected man touches another non infected man, that man also changes his animation to sick.

I am able to do both of these separately but am unable to combine them for some reason. What am I doing wrong? Any help is appreciated. I know this shouldn’t be so complicated.

You need to put your condition inside the for each loop, so that it says:
“For each instance of man, if covid is in collision with man, do this, do that.”

But you’ll have a problem with your second part (Man&Man) because when you say “infected of Man is yes, change animation of Man to sick”, the game will think you talk about the same Man. You need a way to tell them apart :thinking: most likely, variables.

Maybe try an Object var or Instance variable in Man Sprite, the if Collison occurs with COVID set Man instance Variable to infected, so in the Foreach of Man&Man one of the is goin to be infected because of the instance variable is 1 and the other will be health because the instance var is 0