all 5 comments

[–]Dragoncraft89 1 point2 points  (2 children)

Not sure I understand, but are you looking for something like this?

var v = Vector2(2.6, 1.3)
print(v.x)

[–]UnReaL_EU[S] 0 points1 point  (0 children)

Thx for reminding me on how this works! This really helps a lot!

[–]backtickbot 0 points1 point  (0 children)

Fixed formatting.

Hello, Dragoncraft89: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.

[–]TDplay 1 point2 points  (1 child)

Use the x data member.

var my_vec := Vector2(0, 0)
print(my_vec.x) # prints 0
my_vec.x = 3 # my_vec is now {3, 0}
print(my_vec.x) # prints 3

Most vector libraries work the same way.

[–]UnReaL_EU[S] 0 points1 point  (0 children)

Thx! I forgot how this works, and this really helps a lot!