I am making a match statement that compares a vector's x and y values, however, it only works for my x-axis.
print(distance_to)
print(vector2_to_string_match(distance_to))
var y_axis = stepify(distance_to.y, 0.1)
var x_axis = stepify(distance_to.x, 0.1)
print(str("y axis = ", y_axis, ", x axis = ", x_axis, "\ny_axis == -0.7 which is ", y_axis == -0.7,
"\nx_axis == -0.8 which is ", x_axis == -0.8))
the results give me
(-0.754222, -0.656619)
y axis = -0.7, x axis = -0.8
yaxis == -0.7 which is False
xaxis == -0.8 which is True
I recreated it in a new godot project and it's still working like this.
var vector = Vector2(-0.751234, -0.6545)
var y_axis = stepify(vector.y, 0.1)
var x_axis = stepify(vector.x, 0.1)
func _ready() -> void:
print(x_axis == -0.8) # returns True
print(y_axis == -0.7)# returns False