marros1812 Posted December 30, 2015 Share Posted December 30, 2015 I have my enemies and they will move and change direction on the x axis when they collide with a collision box. At the moment it has a walking animation but I want it to change to the opposite direction when it collides. My enemies are in a group and I can't figure out how to access them to change their individual properties when they collide with a box. Anu ideas? Link to comment Share on other sites More sharing options...
marros1812 Posted December 30, 2015 Author Share Posted December 30, 2015 I managed to get this. I created a function that is called when an object in the enemies group collides with a collision box. I passed in the object from the collision and set scale.x *= -1. Hope this helps anyone elese. The function I used liked like thisfunction changeDir(enemy) { enemy.scale.x *= -1; }my enemies groups is called enemies. Link to comment Share on other sites More sharing options...
Recommended Posts