Godot Version
4.7
Question
I wanna make it that when player touches spring, player bounces. I know the script Is likely wrong but I’m trying
func _on_area_2d_body_entered(body: Node2D) -> void:
if body.is_in_group("spring"):
velocity.y = JUMP_VELOCITY*1.5
wchc
August 10, 2026, 8:23pm
2
There is nothing wrong with the script. Does it work? Doesn’t work? Any errors?
You need to give us some more context.
Please check Posting guidelines in #Help channel and try to answer all questions mentioned there.
No it does not work. If script seems right than idk what it is than :l
Do you want to build up or just an instant launch upwards?
Have you tried calling the player script and adjusting the velocity accordingly?
Try this and mark as solution if it works (I am a solution farmer LOL):
func _on_area_2d_body_entered(body: Node2D) -> void:
if body.is_in_group("spring"):
velocity.y -= JUMP_VELOCITY*1.5
I use -= jump_velocity on this script her.
I ade this mistake sooooo often with my jumps.
Look if the area is colliding with a print statement, and check thr collision layers and masks.
Is it possible you’re resting or changing velocity in your player movement code and that overwriting this change?
Is the signal connected correctly to the player in the signal tab?
Put a print statement in that function to see if it’s getting called at all.
If this is a signal handler for the area that represents a spring then the body argument would be a body that entered it, presumably the player. So checking if the player is in the group spring doesn’t make a lot of sense.