• 2D
  • Bouncing of a wall using move_and_slide() function .

Hello, I'm trying to make a 'Jump King' like game using godot engine. I'm looking for a method that can make my player bounce off a wall by jumping on it without using move_and_collide(). My approach is that i need to find the normal vector of the wall (static body ) i bounced off and then use the .bounce() method. Thank you in advance for your help.

Solved using this:

func collide_on_wall():
	if velocity.x !=0:
		v = velocity.x
	for i in range(get_slide_count()):
		var collision = get_slide_collision(i)
		if collision.collider is TileMap and not is_on_floor():
			velocity.x = collision.normal.x*abs(v)*0.6

Fixed the formatting and thanks for providing the solution for others as well.