diff --git a/Bullet.gd b/Bullet.gd index 2bf23c8..3ee0552 100644 --- a/Bullet.gd +++ b/Bullet.gd @@ -6,21 +6,14 @@ var target := Vector3.ZERO var acceleration := Vector3.ZERO var velocity := Vector3.ZERO -export var acceleration_factor = 5.0 -export var accelerating := false - export var coefficient_of_restitution := 0.5 func _physics_process(delta): - if accelerating: - var direction = (target - global_transform.origin).normalized() - acceleration += direction * acceleration_factor * delta - velocity += acceleration - var collision = move_and_collide(velocity * delta) if collision: + # Reflect the bullet and decrease the velocity according to the coefficient of restitution var normal = collision.normal velocity = coefficient_of_restitution * (velocity - 2 * velocity.dot(normal) * normal) diff --git a/ShootyEnemy.gd b/ShootyEnemy.gd index 89173fe..cf06b96 100644 --- a/ShootyEnemy.gd +++ b/ShootyEnemy.gd @@ -32,7 +32,7 @@ func _ready(): _set_velocity_to_fly_towards_next_target() -# Picks the next target position from the `target_paths` list and set the `velocity` appropriately +# Picks the next target position from the `target_paths` list and sets the `velocity` appropriately # so that the target will be reached after `target_fly_time`. func _set_velocity_to_fly_towards_next_target(): current_target_index = (current_target_index + 1) % target_paths.size()