+1 vote

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:
        if collision.collider.has_method("hit"):
    emit_signal("removed", self)

func _on_VisibilityNotifier2D_screen_exited():

func _on_Meteor_Hit_body_entered(body):

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:

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()
        markers[item]= new_marker

func _process(delta):

    if !Player:
    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
in Projects by (28 points)
edited by

1 Answer

0 votes

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

by (2,092 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.