Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.
Finishing toucheseelSkillzAt this point in the code, the bouncer continues to pursue the player, even after crossing the finish line, so I added an extra function `stop` to the `res://lessons/bouncer.gd`.
```gdscript
# ...
func stop():
set_physics_process(false)
_runner_visual.animation_name = RunnerVisual.Animations.IDLE
```
and an extra line of code in the `res://lessons/game.gd`.
```gdscript
# ...
func _ready() -> void:
# ...
finish_line.body_entered.connect(func (body: Node) -> void:
if body is not Runner:
return
bouncer.stop() # This is the extra line
# ...
```
At first I simply used the `bouncer.set_physics_process(false)`, but that left the `bouncer` in the running animation, which looked weird.
P.S.: Subject line pun intended.21Dec. 11, 2024
Wow this so good!CelsLast month, I decided to step back from programming entirely. I felt overwhelmed and realized I didn’t yet have the knowledge or skills to create a full game. It was a tough decision, but taking that time off gave me clarity. Now, after reflection and learning, all the pieces have finally come together. I feel ready to move forward, and this is exactly the codes I needed to continue my journey as a game developer. Thanks a lot and make more11Nov. 28, 2024
Does the desired_velocity assignment need to be multiplied by delta for accurate collision detection?◆ LPWithout multiplying by delta, the raycast2D keeps the collision as true for a while even after being away from the collision shapes. This is results in way more movement in opposite direction than intended.
After I did `desired_velocity += calculate_avoidance_force() * delta`, the bouncer started running smoothly toward the player again.30Dec. 12, 2024
Thank you!few-apeThis has been a fantastic lesson!
I really appreciate the break down of the intensity formula as well.
I've begun working on a little project and there were so many moments where I thought to myself, "I didn't know you could do that!" during this lesson.
I really appreciate it!10Nov. 23, 2024
Internal raycast collisionsMarcJJust FYI, I was getting odd movements from the avoidance force logic until I noticed the code in the completed bounder.gd in the _ready function at line 22
```gdscript
for raycast: RayCast2D in _raycasts.get_children():
raycast.add_exception(self)
```
I know the callout box "[Raycasts collide with nodes from the same scene by default!](https://school.gdquest.com/courses/learn_2d_gamedev_godot_4/top_down_movement/smarter_bouncer#)" mentions this, but it also says that raycasts shouldn't collide internally by default.90Nov. 12, 2024
intensityram876Hi! After we included intensity in the calculations, if the runner stands behind an obstacle at right angles to the direction of the bouncer, then the bouncer began to get stuck. But I increased the avoidance_strength a lot and bouncer started pushing off obstacles again.10Nov. 07, 2024
Lesson Q&A
Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.