Hey everyone, I wanted to showcase a feature I implemented, with some code included. Would love to hear thoughts/feedback on this. This is the first time I am posting a video of my MMO, all feedback is welcome.
The feature I finished is Item Drops from enemies. When an enemy is defeated, there is a 1/X chance of the player receiving a given item on the enemy’s drop table.
Here’s the video. I’m specifically looking for feedback on the GUI, but again any and all feedback is welcome
I utilized two ThreadQueues to only slide up to 2 drops on the screen at the same time. Subsequent drops are put into the queue and only displayed after the current drop is finished displaying. Here’s what some of that code looks like on the client:
function ClientItemDropManager:AddDropToQueue(item: SharedTypes.UIItem)
self = self :: ClientItemDropManager
local reference = self
if self.QueueSwitch then
task.defer(function()
self.Queue1:SubmitAsync(function()
reference:DisplayDrop(item, true)
end)
end)
else
task.defer(function()
self.Queue2:SubmitAsync(function()
reference:DisplayDrop(item, false)
end)
end)
end
self.QueueSwitch = not self.QueueSwitch
end
You might be wondering why I do local reference = self. Seems redundant right? Well, the type checker sometimes doesn’t like when you reference self inside of task.defer or task.spawn, as well as callback functions, and this solves that.
Looks pretty neat, don’t know whether you’ll have multiple item drops be possible (for example by having killed multiple enemies in one attack, of which more than 1 drop an item) but in the case that is a thing, I think making the “Item received” UI popup a little smaller and stackable(as in stacking multiple of those popups on top of eachother) would look nice.
Also maybe making the gap between the popup & screen border a little thinner;
This is a great point. At present, I was planning on only allowing the player to fight one enemy at a time, but that may change and if so I would need to take this into consideration.
That makes sense making the buttons vertical. I have them horizontal because I have a sliding menu that comes out underneath them. Not sure how that would look with the buttons on the left. https://gyazo.com/8dfd709f61939e31c6450170ee99143c