So I’m making 2D game and i want to make lava that will go up as time goes and will kill player when it touches him but i don’t know how to make the game know if lava collided with player because when I’ll put collider on lava it will collide with walls and I have no idea how to make other way.,so i am making 2d platformer and i want lava to go up as time goes and make it that if player hits touches lava it will reset him to start but i don’t know how to make collision not effect any other colliders and just notice if player is triggering the lava or not
Hi! In the box collider in the inspector you will see “Is Trigger”. If you check this, the lava will respond to the trigger of an effect you put in a script. I am not a pro, but I have a simple way to make the lava kill you when it hits you. Before you go into the script, you have to add a tag by clicking “tag” under the inspector and hitting “add tag” and clicking the “+” button and typing in your tag. This tag can be whatever you want it to be (ig. death). Then, set the lava to that tag. In the player script, add this to whatever you have:
void OnTriggerEnter2D (Collider2D collision)
{
if(collision.tag == "tag name")
{
death();
}}
public void death()
{
transform.position = new Vector2(desired x position, desired y position);
}
This will make your player go back to your desired restart position. Hope this helped!