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