Answer the question
In order to leave comments, you need to log in
How to make a sequence of actions for a prefab?
Please tell me how you can do a sequence of actions for each of the prefabs, as soon as it reaches a certain point. For example, initially, many little people are flying down, but as soon as one of them reaches a certain point, the little man should start moving to the right, while such a change in direction should not affect the rest of the little men who are still in flight. What is responsible for this? how can this be done?
Added:
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.tag == "Floor")
{
Heart.hearts--;
if (Heart.hearts <= 0)
{
SceneManager.LoadScene(2);
}
}
if (collision.gameObject.tag == "Bullet")
{
ManHit();
Destroy(collision.gameObject);
}
}
private void FixedUpdate()
{
Man.transform.Translate(0, -speed * Time.deltaTime, 0);
}
How to change the direction of movement when triggered with "Floor" ?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question