How to import this code from godot 3 to 4

Godot Version

4.2.1

Question

we have trying to fade and hide rooftops in a top-down game and we are using codes from this tutorial (http://www.youtube.com/watch?v=hW8f0hkhBXs) but apparently this is godot 3.5 and it’s not in godot 4, commands like self.connect are not in the godot 4. this is the entire code:
class_name TransformArea2d
extends Node

func _ready():
var _error= self.connect(“body_entered”,self,“_on_body_entered”)
var _erroro= self.connect(“body_exited”,self,“_on_body_exited”)

func _on_body_entered(body):
if player.is_player(body):
var parent=get_parent()
_transform(parent)

func _on_body_exited(body):
if player.is_player(body):
var parent=get_parent()
_untransform(parent)

func _transform(_node):
pass

func _untransform(_node):
pass


also this is the fade class:
extends TransformArea2d

func _transform(node):
_fade(node)

func _untransform(node):
_unfade(node)

func _fade(node):
if _can_fade(node):
node.modulate.a= 0.5
else:
for child in node.getchildren():
_fade(child)

func _unfade(node):
if _can_fade(node):
node.modulate.a= 1
else:
for child in node.get_children():
_unfade(child)

func _can_fade(node):
return “modulate” in node


and this the hide class:

extends TransformArea2d

func _transform(node):
node.hide()

func _untransform(node):
node.show()

var _error= body_entered.connect(_on_body_entered)
var _erroro= body_exited.connect(_on_body_exited)
1 Like

Still gives me the error of " res://transformarea2d.gd:7 - Parse Error: Invalid argument for “connect()” function: argument 2 should be “Callable” but is “TransformArea2d”.
res://transformarea2d.gd:7 - Parse Error: Cannot pass a value of type “String” as “int”.
res://transformarea2d.gd:7 - Parse Error: Invalid argument for “connect()” function: argument 3 should be “int” but is “String”."

doesnt make sense, show whole code
because there is no 3rd argument in line 7

i have sent you the whole code… there is nothing more