I want to get a signal in the "levelgenerator" script whenever the area node in "i","ii" and "iii" detects a collision. As you can see I also attached a script "AreaLev" in the area node which is emitting a signal when it detects collision but the "level_generator" isn't receiving it.
Level_generator.gd:
onready var Leviv = $iv/RootNode
var last_pos = 0
var new_lev = Levi
func _ready():
$i/RootNode/Plane002/StaticBody/Area.connect("game_over",self,"game_over")
$ii/RootNode/StaticBody/Area.connect("game_over",self,"game_over")
$ii/RootNode/StaticBody/Area.connect("game_over",self,"game_over")
$ii/RootNode/StaticBody/Area.connect("game_over",self,"game_over")
func _process(delta):
var val = rand.randi_range(1,4)
if val == 1:
new_lev = Levi.duplicate()
elif val == 2:
new_lev = Levii.duplicate()
elif val == 3:
new_lev = Leviii.duplicate()
elif val == 4:
new_lev = Leviv.duplicate()
add_child(new_lev)
new_lev.rotation_degrees.y = 90
new_lev.translation = Vector3(last_pos + 19.8, 0, 0)
last_pos += 19.8
func game_over():
print('game_over')
Arealev.gd:
extends Area
signal game_over
func _on_Area_body_entered(body):
emit_signal("game_over")
file donwnload:
https://drive.google.com/drive/folders/1Wpr9PJLod_U0lUdKWiJqNdNWsXwJqJUB?usp=sharing