Hello guys,
I have little problem. I have a small game with group of 20 same enemies (instances) they all move in the same direction. And now I want that when some of them hits the wall they change direction.
So I have something like
enemy1. on collision with wall {
enemy1. reverse 8direction
}
It works perfectly the only problem is that I want to change direction for all those instances immediately once whatever instance collides with the wall. But right now it acts separately. So for example instance 1 change direction when it hits the wall. Instance2 changes direction when it hits the wall. What I want is:
when whatever instance hits the wall, change direction for all of them immediately.
What is the solusion? Do I need to use foreach loop or something? thank you