Hey alls, can you help me to find a good tutorial for saving game hichscores? i have a global var called scores and an stored name and i will save it so when i restard the game, this values are loaded in a scene to show a highscore list. i searched a lot but all tutorials a very ...ehm...complicated for me, in english... so is there a way to explain it in an easy way? xD lol, i hope u understand me xD

Thank you Neo

If you have the variable, you should be able to use File.store_var to save the variable to a file. Here’s a link to the Godot Docs on File, which has a simple example of saving/loading from a file.

You can use the example code in the documentation description for File if you need/want, just replace store_string and get_file_as_text with store_var and get_var, placing your variable as the argument for store_var.

Let me know if it does not make sense and I’ll see if I can make a example script showing how it works.

(I do not know of any saving/loading tutorials, sorry!)

Hi @TwistedTwigleg , thank you, this helps my a lil bit :) Its not easy and while featuring out how it works, i found a nice tutorial series, where it is explained in the last video (no 16). the tutorial is a nice basic serie to create a scroll down space shooter...so i started to do what is shown in this video...

! i am on second video and try to script the "follow the mouse"

...so what i have to say... its for Godot 2. and the scripts are not compatible to 3.0 This simple snipset will show what i mean: func _process(delta): var pos = get_pos() pos.x = get_global_mouse_position().x set_pos(pos) pass

...its hard, but i dont give up xD

Thank you Neo

I think the example code you posted would convert to this (in theory):

func _process(delta): self.position.x = get_global_mouse_position().x

I have not tested the code above, so I cannot guarantee it will work. (Unfortunately I’ve had little time to test/work with Godot today :neutral:)

The biggest change from Godot 2 to Godot 3 that I’ve found is the removal of getter/setter functions. Most of the times, any function that has set_ or get_ generally can be used by simply using the variable name. Another change is any short hand, like pos, has changed to its full name, position.

Let us know if you need any help, and good luck!

Hi :)

@TwistedTwigleg said: I think the example code you posted would convert to this (in theory):

func _process(delta): self.position.x = get_global_mouse_position().x thats right - it works! also on mobilephone - thank you very much :)

@TwistedTwigleg said: The biggest change from Godot 2 to Godot 3 that I’ve found is the removal of getter/setter functions. Most of the times, any function that has set_ or get_ generally can be used by simply using the variable name. Another change is any short hand, like pos, has changed to its full name, position. Nice to know - it makes a lot easier to understand Godot tuts from old versions - ill have a look on it, thank you again :)

p.s.: i cant set "answered" here, because i hijacked my on questionpost with an other question...you answered xD

sorry for hijacking and Thank you again! Neo

Hi again :)

@TwistedTwigleg said: If you have the variable, you should be able to use File.store_var to save the variable to a file. Here’s a link to the Godot Docs on File, which has a simple example of saving/loading from a file.

You can use the example code in the documentation description for File if you need/want, just replace store_string and get_file_as_text with store_var and get_var, placing your variable as the argument for store_var.

Let me know if it does not make sense and I’ll see if I can make a example script showing how it works.

(I do not know of any saving/loading tutorials, sorry!)

Your link did it in combination with looking the tutorial i posted (No 16) and looking back to your link.

Also thank you for your description, it helped me to fix store_string!

Now "answered" :) Thank you! Neo