I'm trying to figure out how to make a ball bounce in Godot 4.1, but I cant find anything that works. most are for Godot 3 and some are just how to add effects to ball bouncing. I did find something in the Godot engine Q&A but I cant understand what they are saying and the code doesn't work. I have a ball scene that's a CharacterBody2D with a Sprite2D and a CollisionShape2D. this is my code:
`extends CharacterBody2D
func _ready():
set_velocity(Vector2(100, 0))
func _physics_process(delta):
var collision_info = move_and_collide(velocity * delta)
if collision_info:
velocity = velocity.bounce(collision_info.get_normal())
`