Hello everyone. I am a begginer in Godot and GDScript, so my question might have an obvious answer.
I am making a turret game but when the player shoots, the bullets follow the mouse.
Here is the code for bullet movement and spawning:
if Input.is_action_pressed("shoot_bullet") and can_fire:
var bullet = bullet_scene.instance();
bullet.position = $point.position;
bullet.apply_impulse(Vector2(), Vector2(bullet_speed, 0).rotated(deg2rad(rotation_degrees - 90)));
print("Shooted a bullet");
can_fire = false;
$Timer.start(fire_rate); yield($Timer, "timeout")
can_fire = true;
What is that I have implemented wrong? How can I stop this? Thanks in advance