I am making a point-and-click style adventure game where the player can put items in their inventory, and then double-click on those items in order to use them. It does this by changing the mouse style to match the sprite of whatever item they clicked on. However, as the scale of my game has increased, a delay has grown between double-clicking the item and the mouse sprite changing.
Right now, it there is a full two second delay, which is not only noticeable, but is also causing bugs. But, weirdly, after the first time an item has been used, the next time the player uses that item, the mouse sprite changes immediately. With this in mind, I tried creating a function that looped through every item sprite at the start of the game, and set the mouse sprite to each object. While this loop has gotten rid of the delay, there are now two new problems: one, there is a brief moment at the start of the game where the mouse cursor somewhat noticeably flickers between all the items, and two, there is a low chance that, after the mouse has looped through all the item sprites, the mouse sprite doesn't return to the regular mouse cursor sprite.
All this to say, is there a simpler way for me to fix this delay problem that doesn't result in more issues? I appreciate any help.
Link to video showing gameplay without the mouse sprite loop.
youtu.be/_iLWGeGyhMo
Link to video showing gameplay with mouse sprite loop working "properly".
youtu.be/9hfSWYfX0Uw
All items that can be picked up by the player are a part of the "InvItems" family.
Image of the code used for the mouse sprite loop. I am aware that it is extremely brute force-y. I originally just had a single for-each member of the InvItems family loop, but I was experiencing the previously mentioned issue (where the mouse sprite would not return to the regular cursor sprite) much more compared to after I changed it to the code pictured.
If you need any more information, feel free to let me know!