Loading the player’s avatar
Welcome to AvatarScreen! This is where the player will be able to customize their avatar appearance and select a unique name in the final version of our (fake) game. To display their current available avatar, we need to load the player’s avatar data from the database and display it on the screen.
For that, the AvatarScreen scene is made up of a Control
node called AvatarScreen, which holds all the other nodes in the scene, including a Control
node called AvatarCard:
Figure 2.5 – The AvatarScreen scene’s node hierarchy
The AvatarCard node contains a TextureRect node to display the avatar’s image using a texture file and a Label node to display the avatar’s name.
To load the player’s avatar, we first need to retrieve the path to the image file from our fake database, which we previously populated with avatar information. So, before we dive into the action in the AvatarScreen...