diff options
author | IcECreAm777 <hgk.1998@googlemail.com> | 2023-07-08 16:43:32 +0200 |
---|---|---|
committer | IcECreAm777 <hgk.1998@googlemail.com> | 2023-07-08 16:43:32 +0200 |
commit | 78b6db9f792e18d848383856693cff4ef223a10f (patch) | |
tree | 4d0385ae8eb8f450a6b2c40c1886a964134d154d /Scripts/car_behaviour.gd | |
parent | bf17c8a97b77cdb783a2751e7ee4a90843a00f06 (diff) | |
download | 2023-78b6db9f792e18d848383856693cff4ef223a10f.tar.gz 2023-78b6db9f792e18d848383856693cff4ef223a10f.tar.bz2 2023-78b6db9f792e18d848383856693cff4ef223a10f.zip |
checkpoint detection and UI
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 |