this is my code but it says "Invalid Call Nonexistent Function 'getchildcount' in base invalid
(I made those alterations because it does not allow me to use if without a function, and the same applies to print, also there are underscores where this message doesn't show them but they're supposed to be, I don't know why the code sample doesn't show them)
extends Node2D
onready var enemyparent = $EnemyParent #Reference to enemy's parent
onready var door_node = $Door #Door Reference
var enemycount = enemyparent.getchildcount()
func ready():
print("enemy count: " + str(enemycount))
func countem():
if enemycount == 0:
door_node.hide()