I need help Minimap , and crashing kidscancode tut

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By StsDevSquad

So I have been following this tutorial from kids can code for a minimap, I got everything working , now my only problem is when a object is destroyed it crashes!! at a certain point in the written tut he explains how to fix it but for some reason I can not get it to work , the error im getting is

    connect: In Object of type 'Area2D': Attempt to connect nonexistent signal 'removed' to method 'MarginContainer._on_object_removed'.
  <C++ Error>   Condition "!signal_is_valid" is true. Returned: ERR_INVALID_PARAMETER
  <C++ Source>  core/object.cpp:1503 @ connect()
  <Stack Trace> Meteor.gd:9 @ _ready()

and here ia my code 
**Meteor Code**

 

       extends KinematicBody2D
var minimap_icon = "meteor"
onready var mini = get_node("../Player/Camera2D/CanvasLayer/Minimap")

signal removed()

func _ready():
	for object in get_tree().get_nodes_in_group("minimap_objects"):
		object.connect("removed",get_node("../Player/Camera2D/CanvasLayer/Minimap"), "_on_object_removed")
	
	
	


var speed = 0
var velocity = Vector2()

func start():
	velocity = Vector2(speed, 0).rotated(rotation)
	

	

func _physics_process(delta):
	var collision = move_and_collide(velocity * delta)
	if collision:
		queue_free()
		if collision.collider.has_method("hit"):
			collision.collider.hit()
	emit_signal("removed", self)
			

func _on_VisibilityNotifier2D_screen_exited():
	queue_free()



func _on_Meteor_Hit_body_entered(body):
	pass

Minimap Code

extends MarginContainer


export (NodePath) var Player
export var zoom = 1.5 



onready var Mini = get_node(".")
onready var grid = $MarginContainer/Grid
onready var player_marker = $MarginContainer/Grid/PlayerMarker
onready var tile_marker = $MarginContainer/Grid/TileMarker
onready var meteor_marker = $MarginContainer/Grid/MeteorMarker
onready var icons = {"tile":tile_marker, "meteor": meteor_marker}
var Radar_Scan = false


var grid_scale
var markers= {}

func _on_object_removed(object):
	if object in markers:
		markers[object].queue_free()
		markers.erase(object)


func _ready():
	player_marker.position =grid.rect_size /2
	grid_scale = grid.rect_size / (get_viewport_rect().size * zoom)
	var map_objects = get_tree().get_nodes_in_group("minimap_objects")
	for item in map_objects:
		var new_marker = icons[item.minimap_icon].duplicate()
		grid.add_child(new_marker)
		new_marker.show()
		markers[item]= new_marker
		
	
	
	
		
	

		
	
func _process(delta):
	
	
	
	
	if !Player:
		return
	player_marker.rotation = get_node(Player).rotation + PI/2
	for item in markers:
		var obj_pos = (item.position - get_node(Player).position) * grid_scale + grid.rect_size / 2
		if grid.get_rect().has_point(obj_pos + grid.rect_position) and Radar_Scan == true :
			 markers[item].scale = Vector2(0.5, 0.5)
		else : 
			 markers[item].scale = Vector2(0.1, 0.1)
			
			
		if Radar_Scan == false:
			markers[item].scale = Vector2(0, 0)
		
		
		if Input.is_action_just_pressed("Radar_Scan") and Radar_Scan == false:
			Radar_Scan = true
		
		
		if Input.is_action_just_pressed("Map_Zoom_Out") and Radar_Scan == true:
			Radar_Scan = false
			
		
			
			
			
			
			
			
		obj_pos.x = clamp(obj_pos.x, 0, grid.rect_size.x)
		obj_pos.y = clamp(obj_pos.y, 0, grid.rect_size.y)
		
		markers[item].position = obj_pos

		

Yep, I’m having exactly that issue.

Update:

Just found this thread and it solved my problem, I think…

https://www.reddit.com/r/godot/comments/h994is/how_do_i_connect_a_signal_between_two_different/

CassanovaWong | 2022-03-06 00:56

:bust_in_silhouette: Reply From: Lopy

Meteor, line 7, you wrote signal removed() instead of signal removed .

Edit

In the _ready of your Meteor your try to connect a signal named removed inside members of the group “minimap_objects”, to the function _on_object_removed in your Minimap:

func _ready():
    for object in get_tree().get_nodes_in_group("minimap_objects"):
        object.connect("removed",get_node("../Player/Camera2D/CanvasLayer/Minimap"), "_on_object_removed")

As you define a signal named removed in your Meteor (with signal removed()), I believe you meant to connect that Meteor’s removed signal instead:

func _ready():
    self.connect("removed",
        get_node("../Player/Camera2D/CanvasLayer/Minimap"), "_on_object_removed")
    

Here is the official tutorial on how to use signals:

https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html?highlight=signals

wait, what? Do you mean _on_object_removed instead of what you wrote, signal removed()? Or did StsDevSquad change their original post? or … did I miss something?? I’m having the same issue as the OP, same tutorial, pointing to same line of code… same error, etc.:

https://kidscancode.org/godot_recipes/ui/minimap/

CassanovaWong | 2022-03-06 01:09