Hey guys! So I have yet to work with any kind of rotations. I am trying to make it where the enemy on the map reaches a point via path using check points - when it reaches a certain check point i want it to rotate 180 degrees. So it goes down the screen, hits a collider, and rotates as it makes its way back up the screen.
void OnTriggerEnter2D(Collider2D other) {//looking for colliders.
if (other.tag == "CheckPoint")//if check point, increase target array by 1 to move ot next point
target += 1;
else if (other.tag == "Finish") {//if tag is finish, destroy yourself by running the unregister enemy
GameManager.Instance.RoundEscaped += 1;//if exits add one to round and total escaped
GameManager.Instance.TotalEscaped += 1;
GameManager.Instance.UnregisterEnemy(this);
GameManager.Instance.isWaveOver();
So, essentially when it collides with these check points, it adds 1 to its next destination in an array somewhere else in the script. Its here that I will place the additional else if. So else if (other.tag == “Fridge” )- then rotate. The object is tagged as “Fridge” essentially mice are running down a path way to the fridge, when they hit the fridge they will be hidden for a moment cause they go “under” the fridge visually - this will allow them to rotate without our view. I have no idea how to create a rotation, and the Rotation/rotate functions are super confusing. Any tips?
Also, Im working on having the fridge spawn an object on top of the mice. Is it possible to have an object follow a moving target? As if the mice is carrying it? or would it be easier to make a class of “mice” and make different types of mice and have one set as the art style of carrying? Seems more redundant but im not 100% sure on what path to take for this yet as it will be my first game