Search code examples
game-enginegodotgdscript

Adding items from a player to the tilemap godot


I am trying to drop items from a players inventory onto the floor. Currently, I am storing items as kinematicBody2Ds, this will likely change, but I would like to create a node on the map via GDScript.

Is it possible to create items from already created TSCN files in this process to avoid redundancy?


Solution

  • You can create instances from the TSCN files, using the load/preload methods.

    var node = load("res://pathToFile.tscn").instance()
    

    From there I could change settings of the node and create a new instance of the object.