about picking up items

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

which on is more preferred if i have 1000 item that can be looted ?

using body entered signal OR the Item body is kinematicBody (Item is area 2D).

if i use kinematicBody(Item is area 2D) on all of the item and they all have script… does performance of my game will be lagging ?

Not sure what you’re asking. You should probably use Area2D if you want to pick up the item, i think you’re asking if you should detect the items in the player script or the item script, and I think there wouldn’t be much of a performance difference, because you’re using area2d detection anyway.

SoMir | 2021-06-15 14:34

:bust_in_silhouette: Reply From: Help me please

I think there won’t be lagging because all the 1000 signals won’t emit at the same time but if you instance all these in the editor then it might take long to read all the codes at the runtime.
But for more surity try not instance all the items and loots at the editor but instance them during runtime with codes.
Example

func instance_item(which_one):
    var s = load("res://ItemsFolder" + which_one + ".tscn").instance()
    add_child(s)

Here just call this function with the item you want to instance and remember name of item should be similar to its scene’s name
The way I told you earlier was devoloped by me. So that won’t be much trustworthy but will still work fine :slight_smile:

:bust_in_silhouette: Reply From: Help me please

It is totally upon you which way you prefer. details of both ways are with you.
In case something goes wrong then ask.