![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | roxy248324 |
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