are you know tutorial of 15 puzzle(sliding puzzle)?

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

i watched this video.but it not work well.

I may be wrong but i get error in line 16 (set_fixed_process)
this is errror message
Parser Error: Method ‘set_fixed_process’ is not declared in the current class.

i use version of 3.1 stable.please help.

:bust_in_silhouette: Reply From: volzhs

set_fixed_process() is changed to set_physics_process()
and also func _fixed_process(delta) to func _physics_process(delta)

It seems that it was an old version
Thanks for solving.

bgegg | 2019-04-02 20:40

Hi, error: Invalid call. Nonexistent function ‘set_pos’ in base ‘Sprite’.


img[n].set_pos(Vector2(map[y].find(n) * 100, y * 100))

Godot 3.2.3

sakunix | 2021-02-25 20:05

set_pos() was removed with the release of Godot 3.0 in early 2018, so this tutorial you’re looking at must be over 3 years old. I highly recommend that if you’re learning you use more up-to-date materials. Old non-working code is going to be frustrating to convert.

In 3.0, pos was renamed to position, and setters are no longer necessary, so for this particular line, the equivalent code would be

img[n].position = Vector2(map[y].find(n) * 100, y * 100)

kidscancode | 2021-02-25 20:08

Thanks for the information, the debugger should warn when an old function no longer works and why it was changed, this is how PHP works.

The code that worked is: img[n].set_position(Vector2(map[y].find(n) * 100, y * 100))

but even so, there is a displacement problem and it is not the same as the video example.

sakunix | 2021-02-25 20:42