0 votes

i am making a project where the player have lots of characters to use so he can make a team and go to battle is a turn base rpg, but to the battles i didn't find a way to send what scenes/character is the player team, i wanted to do something like that

(this code is just to give the idea, i know preload don't work like that)
var char1path = ""
var char1 = preload(char1
path)

func player_team(char1_path):
        self.char1_path = char1_path

the game is gonna have more than 50 characters because of that i think, preload everyone would be too much things for the memory.

in Engine by (15 points)

1 Answer

+1 vote

You can load just assets and data necessary for a selection screen and then pass the selected characters for another scene that will load the characters that were actually selected only.

That said, preload loads resources at compile time, so you can't really do that with this level of dynamism. What you want, probably, is to use load in this case.

https://docs.godotengine.org/en/3.0/getting_started/step_by_step/resources.html#loading-resources-from-code

by (72 points)

thanks, that really helped a lot

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.