Randomly loading dynamically generated sprites to a scene

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

Hello All,
I’m new to Godot but I have one specific question about dynamically loading sprites into a scene.

My game could potentially have 5 - 100 different sprites with customization options.

Where can I look up how to load a sprite dynamically into a scene such that that sprite characteristics are loaded along with it’s attributes?

There will always only be 2 - 6 characters on the screen at once, but those 2 - 6 characters would be randomly chosen.

Characteristics and attributes will be stored in a DB somewhere.

Thank you!

:bust_in_silhouette: Reply From: exuin

It depends on what kind of format the database is. Like, is it json? Godot has support for reading JSON files.

Yes, I can have the data in JSON.
Basically I will be retreiving character traits from the DB. Then I will need to load or generate the rite sprite with those attributes. The animation for running would also depend on the attributes.

Do I make templated sprites and then load the correct one and apply masks to that sprite?

thedangler | 2022-12-09 00:35