Hello.
I have another problem I have run into and I just honestly can't right now. I have a player who moves fine and is able to pick up enemies fine, and throw and drop the enemies fine..... so now I have introduced a key to the game that I want to behave just like the enemies, but I don't want it to move on it's own, I want it to remain where it is and follow the player whenever it's held.
But now, whenever I have my player holding the key it won't move. I'm using the same code I used for enemies, since they're both grabbable objects, but the player won't move while holding the key. I need the key to drop until it hits the floor tiles and then just stay there until picked up again.
So... here's the key code:
if not held:
velocity.x = 0
velocity = move_and_slide(velocity, Vector2.UP)
velocity.y += gravity * delta
else:
position = get_node("../Player/Position2D").global_position
I also tried move_and_collide(Vector2(0, gravity * delta)) but in both cases, the player doesn't move left or right while hold the key. I can jump and drop it, and the key behaves as expected, but not move left or right... help please. Let me know if you need more information.