How to change a vector 2 variable in an if statement

Godot Version

4.3

Question

not much to say here I defined the variable with: var hurtbox := Vector2(999999, 999999) and now I wanna change it in an if statement like this: if is_on_right_side == true: hurtbox := Vector2(999999, 999999) but it doesnt work anyone know why

First, I imagine your is_on_right_side variable is a bool. If so, you can replace if is_on_right_side == true: with if is_on_right_side:

Second, you shouldn’t (and maybe can’t, I’m not sure) use the assignment operator := twice on the same variable. Once you say my_var := 5, then in the future just use an equal sign to update it: my_var = 7

Third, it’s not clear what you’re asking. You define the hurtbox as (999999, 999999) but then later you want to change it to the same value (999999, 999999)? I feel I am misunderstanding the question here.