How do I make the ball bouncing

Godot Version

I’m new to GoDot and programming, i watch some tutorials how to bounce a ball in godot but none of them seems to work anymore (or i’m dumb). anyways all my ball can do is to fall on the ground like a stone. Am I missing something?

extends CharacterBody2D

var gravity = 300

func _process(delta):

velocity.y += gravity * delta

move_and_slide()


if is_on_floor():

	velocity.y = -abs(velocity.y)

func _on_Body_entered(body):

velocity.y = -abs(velocity.y)

I’m new on this site

This video pretty much got it covered:

Shorter version:
After colliding, you can remember collision info by saving it into a variable.
With that variable you can calculate where you want to bounce.

var collision_info = move_and_collide(my_velocity * delta)
if collision_info:
	my_velocity = my_velocity.bounce(collision_info.normal)