how do I deal with "invalid get index 'y'"?

ReizenchuuReizenchuu Posts: 1Member

so I'm new to Godot and have started following the documentation not too long ago. when I arrived at the simple 2d game example, I got the following error: "invalid get index 'y' (on base Rect2)".
I thought I did everything as it was supposed to be, so I have no idea about the way to deal with this.
could someone please give me some hint?
here's a screenshot of the project:


  • TwistedTwiglegTwistedTwigleg Posts: 2,459Admin

    I think this will fix the problem:
    At line 19. You have screen_size = get_viewport_rect(), where as you need screen_size = get_viewport_rect().size.

    That should fix the problem, as then you’ll be using the Vector2 for size, which does have a Y member. You can also replace screen_size.y at line 30 with screen_size.size.y, but if you want to keep it the same as the tutorial then it’s probably best to change line 19 instead.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file