Your First Game tutorial - player stuck in top left corner...

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

So a newb to Godot, and im working through the docs, (made sure im on the 3.1 docs) but have got as far as the point where the eyeball character should move around the screen, but hes stuck in the top left corner (his legs wiggle with the up/down/left/right keys pressed tho) and wont actually move…

Im using linux version, but have gone through tutorial again on windows with the identical result. Even started from scratch again with the same prob. Double and trebble checked the scripting bit isnt mis typed… Copy pasted the script to make sure again but still nothing

What on earth have I missed? :frowning:

:bust_in_silhouette: Reply From: kidscancode

It’s hard to answer your question without any details of what exactly you have done (ie what exactly your script says).

A couple of things to try:

  • Check that your indentation is correct. Copy-and-paste, especially from the web, can mess up whitespace.

  • Comment out (this means put a # symbol in front of them) the two lines that clamp() the position on the screen.

Ah ha!

the 3 lines in the tutorial pages…

position += velocity * delta
position.x = clamp(position.x, 0, screen_size.x)
position.y = clamp(position.y, 0, screen_size.y)

arnt clear (for beginning beginners!) what the indentation should be, noted the mistake and it works, thanks!

In theory should it work without these 3 lines?
This bit just stops it moving off the screen and getting lost, no? (so it implies) Without these lines the guy just sits there wiggling his feet!

bingbong | 2019-05-28 23:38

Well, the first line actually moves the player. The two clamp() lines stop it from moving off the screen.

kidscancode | 2019-05-29 00:31

Awesome, thanks for the clarifiaction!

bingbong | 2019-05-29 01:42