Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | System_Error |
Hi all.
I’m trying to disable/enable an area’s collision detection after receiving a specific signals.
The Game Over signal will disable the Area2D’s collision, and the New Game signal will enable the collision. The code below is from Level.gd.
func _on_BaseArea_area_entered(area):
print("Collision!")
$Node/SpawnTimer.stop()
$Node/SurvivalTimer.stop()
$HUD.player_loss()
emit_signal('game_over')
func _on_HUD_play_game():
score = 0
$Node/SurvivalTimer.start()
$Node/SpawnTimer.start()
$HUD.show_message("Survive!")
I was thinking of using set_collision_mask_bit(), but I am having second thoughts.