fix null object

This commit is contained in:
Lucas Peter 2024-07-30 10:14:56 +02:00
parent b8794fdc8b
commit e8a647c49f
No known key found for this signature in database

View file

@ -4,7 +4,7 @@
resource_name = "bridge"
script/source = "extends Area2D
var wallObject : Array
var wallObjects : Array
# Called when the node enters the scene tree for the first time.
func _ready():
@ -18,16 +18,18 @@ func _process(_delta):
func _on_body_entered(object):
print(\"Entered %d\",object)
if (object.has_meta(\"Type\") and object.get_meta(\"Type\") == \"Player\" ):
for _object in wallObject:
if (object.has_meta(\"Type\") and object.get_meta(\"Type\") == \"Player\" and wallObjects != null ):
for _object in wallObjects:
if (_object != null):
_object.process_mode = Node.PROCESS_MODE_DISABLED
else:
wallObject.append(object)
wallObjects.append(object)
func _on_body_exited(object):
if (object.has_meta(\"Type\") and object.get_meta(\"Type\") == \"Player\" ):
for _object in wallObject:
if (object.has_meta(\"Type\") and object.get_meta(\"Type\") == \"Player\" and wallObjects != null ):
for _object in wallObjects:
if (_object != null):
_object.process_mode = Node.PROCESS_MODE_INHERIT
"