0 votes
func _ready():
    state_machine = $Node2D/AnimationTree.get("parameters/playback")
    emit_signal("player_stats_changed", self)
    if facing == true:
        $RayCast2D.cast_to = -150
    else:
        $RayCast2D.cast_to = 150

Please help! Why do i get this error? What does it mean?

in Engine by (63 points)

1 Answer

+1 vote

The cast_to property takes a Vector2 object. You're trying to assign an int to it. So maybe the value should be Vector2(0, -150) or Vector2(0, 150)?

by (1,534 points)

Thanks! But for some reason the raycast won't turn around?

If you need to turn it around, have you tried the rotation() function? E.g. $Raycast2D.rotation(theta), where theta is the desired amount of rotation in radians.

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 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.

Categories