0 votes

So I'm making a tetris like game. I setup my scene like so:

--Ysort # meant to contain the pieces that the cart deposits
--Cart # transports the piece from top to bottom
  --Piece # the piece is just a block

So I want it so that when the cart reaches the bottom of the grid the piece it is transporting gets reparented to the Ysort. I know how to setup the movement, collisions, signals, and get them working. I just don't know how to move the Piece from the Cart to the Ysort. How do I do this?

asked Oct 20, 2019 in Engine by hidemat (91 points)

1 Answer

0 votes
Best answer

Oh I figured it out. When the cart hits the bottom I had to:

  1. Store the piece in a variable.
  2. call the remove_child() fuction on the cart
  3. the add_child() on the Ysort

var piece = cart.get_node("piece")

Word to the wise: Let the parent re-parent nodes

answered Oct 21, 2019 by hidemat (91 points)
edited Oct 24, 2019 by hidemat
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.