#Object is not directly collectible
9 messages · Page 1 of 1 (latest)
Could you show the remote tree view when the game is running? It might be adding an apple as a child of another apple.
Not sure if you should add a child as a child of itself if that makes sense.
its adding a Area2D with every new spawned apple
But it's not a big problem because it will be collectible if the player can reach it. Now the only problem I have is that if I add a Rigidbody2D to the apple, it teleports with every newly spawned apple. (A new position is always added to the apple because of the randf_range, but this is not the case with the current apples that do not have a rigid body.
Okay so i started up the project again and for some reason it works now xD I dont knwo what i changed but it workes now as intended
Glad you solved it!
Yeah, but now I'm having trouble adding gravity to the apples. I don't really know how to do that, so it just doesn't work with rigidbody2d because for some reason it is teleported to a new location in the randf_range every time a new apple spawns.
You could try setting a specific position.y when instancing, that would place them in the air then apply gravity with something like:
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
velocity.y += gravity * delta
Not sure if this is these are the attributes for rigid body though.
i tried that but its saying that velocity is not declared in the current scope.