How to manage change variable depending of node running the script?

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

I’m trying to make simple system for picking up items, but I don’t want to use multiple scripts for each item, let’s say I have apples and oranges, and I want to make script change local variable called “ItemName” if apple runs the script, is it possible? Is there simpler solution?

:bust_in_silhouette: Reply From: Nizil

You can use Area2D to track item, which you pick up. Try to use get_node to check item which you picking.