I have a player with a flashlight. When the player goes inside a place underground, I want to hide the upper world and reset the collision and light masks. I could set the underground to a new scene, but then the enemies from the previous layers will stop chasing it. Right now, the underground part shows the underground world when you're above ground, and doesn't light up when you go into the tunnels, despite the caves having both masks for the underground world and the upper world.
Currently, I'm only trying to set the player to go underground and am working on caves.
func _on_CaveTrigger_body_entered(body):
if body.is_in_group("Player"):
get_node("Sky").visible = false
get_node("Land").visible = false
get_node("Player").set_collision_mask_bit(1, false)
get_node("Player").set_collision_mask_bit(2, true)
get_node("TileMap_Caves/CaveDarkness").visible = true
func _on_CaveTrigger_body_exited(body):
if body.is_in_group("Player"):
get_node("Sky").visible = true
get_node("Land").visible = true
get_node("Player").set_collision_mask_bit(1, true)
get_node("Player").set_collision_mask_bit(2, false)
get_node("TileMap_Caves/CaveDarkness").visible = false