# how to change speed while bouncing

Attention Topic was automatically imported from the old Question2Answer platform.

well, i don’t know if the title is right, i don’t speak english and i’m translating through google translator

but my question is this, in my project the bullets are losing speed until they reach 0, but i also want the bullets to bounce off the wall, to do this i’m using kinematicbody2d and guiding myself through the documentary:
https://docs.godotengine.org/pt_BR/stable/tutorials/physics/using_kinematic_body_2d.html

extends KinematicBody2D

var speed = 750 var velocity = Vector2()

func start(pos, dir):
rotation = dir
position = pos
velocity = Vector2(speed, 0).rotated(rotation)

func _physics_process(delta):
var collision = move_and_collide(velocity * delta)
if collision:
velocity = velocity.bounce(collision.normal)

but doing this has no way to slow down the bullet, I have no idea how to do this, please could someone help me? I’ve been breaking my head for hours

You can use a `velocity = velocity * 0.95` in you _process to have it slow down over time, of a `velocity = velocity * 0.6` if you use it when collisions happen. The shorter writting is `velocity *= .95`.