I Followed the Instructions and I Still Have Problems

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By EccleSoul

Currently following the latest version of the “Your first 2D Game” tutorial on the Godot documentation. I have no idea what is going on but I followed the instructions to the letter. But whenever I try to run the scene and test player movement, a message on the Debugger tells me there is a problem. Here are some screenshots of it. Please help:

Code

Debugger

Commenting the links to the images, since they’re not loading on their own:

Dropbox - code screenshot.png - Simplify your life

Dropbox - debugger screenshot.png - Simplify your life

MisterMano | 2021-10-23 17:58

Wow. The images never showed up. ('-_-)

In any case, can you help???

EccleSoul | 2021-10-23 18:02

:bust_in_silhouette: Reply From: MisterMano

Taking a look at the line the debugger is complaining about, it’s likely the problem is with the screen_size.x.

screen_size is not an automatically generated variable, so if you haven’t declared it in the code, the correct way to get that data is with OS.window_size, which is a Vector2 type. Note that you can hold Ctrl and click on the OS to look at the class documentation.

Funny thing is, that’s how it was shown to me in the original code in the tutorial. I thought the engine was buggy.

EccleSoul | 2021-10-23 18:11