adding to y with just +1 doesn't work, why do i need to use Vector2?

Godot Version

GDquest

Question

Hi I'm completely new to coding. and i was wondering why can't i just add 1 to cell.y to increase the y value? why do i have to use Vector2 to add to the y value?
isn't doing the same thing?

is this just a GDquest thing?

You don’t need to use the vector if you’re adding to just one component. However notice that the example that uses vector used += operator which does addition and assignment, while your code used + operator which only adds but doesn’t assign, so the value of cell.y will stay the same.

5 Likes