Would this be an error?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By System_Error

Hey all. I’m trying to ensure that my Mine doesn’t blow up any walls, just the Player Ship and other Mines that make contact, but…

func _on_DetectionArea_body_entered(body):
if body is_in_group("Destroyable"):
	print("Target detected!")
	targets.append(body)
	timer.start()

… it says there should be a colon (“:”) at the end of the line with if body is_in_group("Destroyable"): even though I already have a colon there.

Is the if tabbed as below?


func _on_DetectionArea_body_entered(body):
    if body is_in_group("Destroyable"):
        print("Target detected!")
        targets.append(body)
        timer.start()

equus | 2018-12-04 17:13

It is. At least, in my editor.

System_Error | 2018-12-04 17:14

:bust_in_silhouette: Reply From: SIsilicon

Looks like you missed a period (.) In the line with the if.

   (Missing)
       |
       V
if body.is_in_group("Destroyable"):

Ah, thank you. Not sure how I’d missed that aside from how new I am to GDScript.

Again, thanks.

System_Error | 2018-12-04 17:34