ItemGem.gd 425 B

12345678910111213141516171819
  1. extends Area
  2. export var item_type = 0
  3. func _on_Item_body_entered(body):
  4. if body is KinematicBody:
  5. #print ("collected item - type = " + str(item_type))
  6. var collectorNode = body.find_node("PlayerInventory", true, false)
  7. if collectorNode != null:
  8. #print ("collectorNode found")
  9. collectorNode.gem_collected(item_type)
  10. queue_free()
  11. else:
  12. print ("_on_Item_body_entered: error - collectorNode == null")