This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Guys, i am really in touble here.

After effort i succeeded to make a save system for my game.I store in a global variable called "bestscore" my best score. I have two scenes. One main scene called MENU with two buttons: one New Game button and one Load game button.The second scene called World and is the biggest part of my game.When i run the project we can see the MENU scene with the two buttons.When someone presses the New Game button then the game starts normally (World scene).I send a signal from New Game Node to MENU Node and in MENU script i have this:


func onNG_pressed():

var fortosi=load("res://World.tscn")
var ins=fortosi.instance()
visible= not visible


When the game starts we can see on the top and a score=0 (Label-child of the World scene).When i collect objects the score counts normally and the save system stores a best score.All right here.

Now,this is the problem.I want when someone presses the Load Game button then on the score (Label) to shows the bestscore.I wrote this in the Label script :


func ready():


but with that way the bestscore is on Label independently if i press the New Game button or the Load Game button.Then, i created a Load Game button as a different scene , i merged it in World scene and i saved it as a scene in MENU scene.I sent a signal from Load Game node to Label node but obviously it was a solution to despair.Τhe Load Game button was on over the World scene and when i runned the project and i pressed the Load Game button obviously did nothing because it belonged to World scene.

Basically , i can start the game when i press the Load game button but the point is how the bestscore can may appear on the Label and starts the game from this score(bestscore). i realized that it is a very compicated situation...

Thank you in advance guys for any suggestion and i am sorry about my english.

in Engine by (223 points)

I tried and this but nothing:

I sent a signal from Load Game node to MENU node and in MENUS's script i wrote this:

## ##
func onLGpressed():
var fortosi=load("res://World.tscn")
var ins=fortosi.instance()
visible= not visible
var node=gettree().getroot().getnode("/World/Label")


I get this:

E 0:00:02:0164 Node not found: /World/Label
scene/main/node.cpp:1382 @ getnode() @ _on

I'm not sure I understand the question:
* You can already start the game with "New Game" and with "Load Game"
* You can already set the Label to the bestscore value in the ready function

If that's true: Wouldn't it be enough to just set bestscore to "0" in the new game function before creating the World instance?

Thank you for your reply.
i just created a copy of World scene and i added there a new Label for the best score.Then, with the load button i open the copy World scene with the best score in this and problem solved . The point is that it took to me 7 days to find a solution for this...!

Thanks again.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.