 One way to earn some money with your games is to have assets that players can buy to customize their experience. So in this video we are going to see how we can use the lootlockers dashboard to create assets and how we can use the API to retrieve the assets data and create this shop that you can see on the right side of the screen. So let's get started. So here we are on the lootlockers dashboard. The first thing that we are going to do is to go to content and then we already are on the asset options. We can create new assets on this screen but on the top right of the screen. So add asset and then let's name the asset our own mouse because I'm going to use the our mouse skin and then we have contacts but we are not going to work with contacts at this moment. So I'll just keep this feature unlocked here and we are going to be presented with lots of options, lots of parameters to mess with. This is how we can manage this asset. So the first thing that we need to do is to toggle this asset first of all because we want to earn money, right? I'll increase the price to 500 and save but you can see that there are lots of other options. For instance, if this is an universal asset you can toggle this on. So for universal assets are assets that everyone can use. Then we have the variation. Variations are like variations of these assets. So for instance, this is a narrow sort of skin. Let's say that once in a while a player can get a blue version of this asset. We can add this variation here. Platform properties. This is very important especially if you want to try to sell this asset on let's say Google Play Store. This is how you link this asset to the product that you are selling on the Google Play Store. If you want to know how this Play Store and everything of this works, please leave a comment below because I'm thinking about making a series about making mobile games with Godot. So feedback will be very good about that. Then we have the most important part which is this filters and storage part because this is where we upload the actual assets files. So I will click right here and go to the asset that I'm going to sell. The actual file will be the scene file. So the Godot scene file because when the players try to gather this on the machine, they will click and Godot will load this scene from the loot locker server and recreate this screen on the player's machine. So this is how this will work. There I have all the scene files from the skins that I have a and the arrow mouse scene file is right here. So I will select this and then I will also upload an image that I will use to represent this asset on the shop because the shop will use texture buttons and then the texture of these buttons will be the image that I am uploading here. So pictures, Monteser database, arrow mouse. Let's save this and in order for loot locker to actually consider that this asset is retrievable so that we can use the API to get access to this asset, we have to toggle it active. There we have it. So now we have an active Percival asset to retrieve it. So how do we present this to players? How we can use this information? How we can gather this asset and use this data on our game? Let's see how loot locker's API can help us with that. So in order to get our assets from the loot locker servers and present them to players, we can make an API call, so an HTTP request, to this URL. We make a get request to this URL and we can use some filters to get exactly what we want. So you can see that in this example we are using the Percival filter but there are other filters available as well. So Percival, not Percival, Rentable, not Rentable, Popular, not Popular. And also we need to pass how many assets do we want to get from this call? So we can pass from 1 to 200 and after that we need to pass an offset so that the API knows from where it should start counting from. So you can see that on this other example here there is the same call but we are saying that we want a count. We want to get assets after this one here. So this is the idea of the first asset actually that it should start counting from. So we want to get 10 assets after this asset here and all of them are Percival. And after we make this call we should wait for a response. That looks quite complex here in this example but don't get scared by this example because you are going to see that it is way simpler than it looks like here. Let's actually see how this works on Godot Engine. Let's go there. So this is the scene that represents the shop and the player's inventory. We are not going to see how inventory works on this video. It's going to be the next video of this series so I'll take this off and let's focus on the shop side of this logic. So I'll open this script, the shop script and let's see how this works. So I have the URL here. So you can see that is the URL that we just saw. And I'm asking it to send me the first 50 assets that it finds. And all of them should be Percival. We can see that the header of this call should also have the X session token that we have stored on the lootlocker single tone. And we have the get method of the request here. So we make the request using the URL, the header. We don't want SSL certification and we use the get method here. Then we yield for the response and gather this body and convert it. We are going to get a JSON structure response and we just want to parse it as a string actually as a dictionary. Then for each asset in the response, which we can access them via this assets key, because this turned into a dictionary, right? So we are assessing, assessing, accessing the assets key. We are going to do the following. We have the scene URL. Remember that we uploaded a scene file in the filters and files when we created the asset using the dashboard. This is how we assess which URL this file is hosted. So we assess the assets, the asset, which is a dictionary as well. And then we go to the files key. And we get the first file key, the first index of this array because this file is an array. And then this also returns a dictionary. So we go to the URL key. This will return the URL in which this file is hosted on the looklocker servers. The same goes for the image that we uploaded as well. But instead of the first index, we go to the second index. And then we have the asset ID. I have this Play Store ID because I actually use Percival, actually Percival assets on Moom Teaser. So I really need this Play Store ID here to recreate everything that will link this asset to the actual asset on the Play Store. So this is not necessary if you are not selling this on your game. You don't need to access this or store this in any form. Then I have this method here that creates skin buttons. Let's see what is a skin button because this is quite important for this logic. A skin button is this, a texture button that has an HP request node as well. And what it does is that it has some variables that is, for instance, the skin image URL that we just saw how we get this. The skin scene URL, same thing, we just saw how we get this. The asset ID that we are getting on the shop method, the Play Store ID that we are getting there as well. And then when this is ready, it basically just straight forward make a call. And this is very important. This is quite important actually. We get, we use for the response. We are asking this URL here. So we are making a request to the image URL saying, hey, what is in this URL here? Give me the file that is in this URL here that's hosted there. And we retrieve that. We use for the response. We retrieve that and we recreate this as a texture file. So we have this image texture, we create a new image texture. We have this image here. And then we tell the image to load a PNG from a buffer because this file here is going to be a very weird file with many, I think they're quite a binary file. And then we just convert this binary, this buffer to a PNG image. And we set the the skin to be this image that we just created. So actually normal is going to be this skin here. Did you understand that? This is how we take the image that we uploaded to the loot locker servers and pick it from the look locker servers and convert make all this conversion to make this skin button actually have the texture that we want it to have. This is how we present all the assets on the shop. So back to the shop logic. Let's go to skin here. We create this button. So basically this just take all this data that we just gathered from the asset in the response that we are getting here and create the button that we just saw. So we inject all this data on this button. So we have this the bottom image URL that we just saw that is this thing here. It is going to be injecting all of this and then it added as a child of the grid because this is a screw container and it has a grid container. This is how it distributes all the assets that and presented in a beautiful way. And after that we connect all of the we connect the press it signal from this button to this method right here. But this is as I said more of a purchase in building logic. So we are not going to to see this on this video on this particular video. And this is it. If we save the scene and test this let's play the game. Authenticating login. We have an authentication. Let's see what is available for us to work with skins loaded that we have the asset that we just created. So this is it for this video. On the next one we are going to see how we can manage the player's inventory because we can give this asset manually to players. So see you there. I hope you enjoy it. Thank you so much for watching. Keep developing and we'll see you the next one.