diff options
Diffstat (limited to 'Scripts/car_behaviour.gd')
-rw-r--r-- | Scripts/car_behaviour.gd | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Scripts/car_behaviour.gd b/Scripts/car_behaviour.gd index 0463dc1..d5fc292 100644 --- a/Scripts/car_behaviour.gd +++ b/Scripts/car_behaviour.gd @@ -1,4 +1,4 @@ -extends StaticBody2D +extends CharacterBody2D # editor variables @export var max_speed = 300 @@ -14,7 +14,6 @@ var interest = [] var danger = [] var chosen_dir = Vector2.ZERO -var velocity = Vector2.ZERO var current_speed = 0 @@ -26,7 +25,6 @@ func _ready(): for i in num_rays: var angle = i * 2 * PI / num_rays ray_directions[i] = Vector2.RIGHT.rotated(angle) - print(ray_directions) func _physics_process(delta): if not driving: @@ -97,9 +95,8 @@ func own_movement(delta): var desired_velocity = chosen_dir.rotated(rotation) * max_speed var actual_speed = lerpf(velocity.length(), max_speed, acceleration) - var actual_angle = lerp_angle(velocity.angle(), desired_velocity.angle(), steer_force) - - print("lerped speed: ", actual_speed, " | lerped angle: ", actual_angle) + var actual_angle = lerp_angle(velocity.angle(), desired_velocity.angle(), + steer_force) velocity = Vector2.from_angle(actual_angle) * actual_speed rotation = actual_angle |