Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | AshTheKindra |
So I’m trying to make a 2D platformer that plays like Super Meat Boy in Godot. I’m currently trying to make the collision detection with an obstacle work. However when I try to get it to work, I get “Invalid call. Nonexistent function ‘destroy’ in base ‘Node2D’”. I have no clue how to fix it. Here is the code for the obstacle:
extends Area2D
func _ready():
set_physics_process(true)
func _physics_process(delta):
if $RayCast2D2.is_colliding():
if $RayCast2D2.get_collider():
var player = get_parent().get_parent().get_node(“/root/Node2D/Player/Beepo”)
player.destroy()
get_tree().reload_current_scene()
func _destroy():
get_tree().reload_current_scene()
pass