Im getting an error and i dont know why.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sollus_PRIME

This is the line of code im getting the error on


Im getting this error-
error(30,16): Invalid in pattern. Only index (A.B) is allowed

it’s hard to say what’s wrong with just 1 line of code.

did you type vector2(-1,0) not Vector2(-1,0)?
why : is added at the end of line?

volzhs | 2019-03-18 12:19

Take a look here to see if it helps you, Cannot call own functions inside a match pattern · Issue #18174 · godotengine/godot · GitHub

intrus18 | 2019-03-18 13:45

This is the full line of code,

func spritedir_loop():
match movedir:
spritedir = “left”
spritedir = “right”
spritedir = “up”
spritedir = “down”

Sollus_PRIME | 2019-03-18 19:36