- Home /
Question by
yuukinamikaze1996 · Mar 15, 2018 at 10:15 PM ·
collision2d-platformer
Square falls on player, 2D platform
So I have this scenario (you can check the image)where I want the red square to fall on the player (blue square) when he collides with the second platform, but I'm new with this and I can't seem to find an answer to this, I have the code for when the red square collides with the platform it's game over and when I press start it just falls right away...any help would be appreciated, thank you
public string nome_objeto_colidir;
public string nome_cenario;
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.name == nome_objeto_colidir)
{
Destroy(collision.gameObject);
SceneManager.LoadScene(nome_cenario);
}
}
} [1]: /storage/temp/113077-capture.png
capture.png
(10.2 kB)
Comment