fix null object
This commit is contained in:
parent
b8794fdc8b
commit
e8a647c49f
1 changed files with 10 additions and 8 deletions
|
@ -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,17 +18,19 @@ 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:
|
||||
_object.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
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:
|
||||
_object.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
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
|
||||
"
|
||||
|
||||
[node name="BridgeNode" type="Area2D"]
|
||||
|
|
Loading…
Reference in a new issue