![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | BOX_Milk |
I want to make a survival game on the new godot
but I can’t do a drop
I tried to do:
getparent().addchild(self)
but it didn’t help
who knows how to drop items?
Godot version Godot: 4 re5
how to make an item drop in godot 4.0 re 5 - Archive - Godot Forum
You’re going to need to explain more. A single of line of code doesn’t really help. What are you trying to do?
exuin | 2023-02-28 14:55
I want to drop an item in my game, I need to create an item and bind it to the parent node, not to the player node.
BOX_Milk | 2023-02-28 17:12
I don’t see why that wouldn’t work, what error message are you getting?
exuin | 2023-02-28 19:17
I do not get errors, but it does not work
as it should, it is created but it is not displayed on the stage
for this I turned here
BOX_Milk | 2023-02-28 20:04
Maybe you need to set the position
exuin | 2023-02-28 20:52
maybe try this?
# moves the item to the player so it appears underneath the player
global_position = player.global_position
# spawns in the item at the top of the scene tree
get_tree().current_scene.add_child(self)
OgGhostJelly | 2023-03-02 15:36