Adding the player’s avatar
In any online game, the player’s avatar is a crucial element that represents them in the virtual world. In the previous section, we successfully authenticated the player and saved their session token and username in our AuthenticationCredentials
autoload. Now, it’s time to use that information to display the player’s avatar in the lobby.
To achieve this, we will retrieve the player’s avatar information from our fake database and create a new AvatarCard
, a custom scene with a TextureRect
node to display the avatar’s image and a label to show its name. This way, players will be able to easily identify each other and feel more connected to the game world.
For that, let’s open the LobbyClient.gd
script. Here, we are going to do three major things:
- Retrieve the avatar information from the server by making an RPC to the
retrieve_avatar()
method. - Implement the
add_avatar()
method thatLobbyServer...