0 votes

Again silly question, but I cannot figure out why does following code draw 2 lines instead one ?

func _draw():
if shooting and raycast.enabled:
    var raycast_collision_point = raycast.cast_to.length()

    if raycast.is_colliding():
        var collider = raycast.get_collider()
        if collider.has_method("hit"):
            collider.hit(damage)

        raycast.enabled = false
        raycast_collision_point = get_global_transform().origin.distance_to(raycast.get_collision_point())

    draw_line(raycast.position, Vector2(raycast_collision_point, 0), Color(234, 229, 52, 0.5), 1, true)

    shooting = false

func _on_RangedWeapon_attack_started():
 raycast.enabled = true
 shooting = true
 update()

func _on_RangedWeapon_attack_finished():
 raycast.enabled = false
 update()
Godot version 3.2.3.stable
in Engine by (87 points)

Edit fixed somehow, not sure what exactly was the issue.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.