Alien Attack - Clamping Players Position issue

Hi folks, I tried to add in the code as mentioned in that section in the Godot course

global_position.x = clampf(global_position.x, 0, screen_size.x)
global_position.y = clampf(global_position.y, 0, screen_size.y)

but I’m getting this error:

Line 39:Unexpected “Identifier” in class body.
Line 40:Unexpected “Identifier” in class body.

Please help! :frowning: Using 4.0.2

I’m so sorry, I just realised what I did wrong… I didn’t tab the variable and the Line 39 & 40! It’s working now.

1 Like

glad you found the solution and your back on track :slight_smile:

it was probably a good mistake to make, just from a learning and debugging perspective.
as sometimes the errors are a little cryptic.

ive done it soo many times as well, either not tabbing correctly or having a space at the start of lines instead.

1 Like

Thank you. Feels good to resolve the issue by myself. Programming was not a strongpoint in my life. :slight_smile:

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms