@ArmouredWizard In programming, "good" is relative to your priorities. This is a perfectly serviceable first iteration. For a future one, consider updating the total when you're adding or removing an item from inventory. This will reduce workload from "all items every time someone asks for the total" to "one item every time an item is added or removed".
Conversation
Notices
-
Embed this notice
Jacek Wesołowski (jzillw@mastodon.gamedev.place)'s status on Thursday, 20-Jun-2024 21:02:58 JST Jacek Wesołowski -
Embed this notice
Armoured Wizard (armouredwizard@dice.camp)'s status on Thursday, 20-Jun-2024 21:03:03 JST Armoured Wizard I've built a function in PlayerManager script to determine the total defence value of equipped items.
It iterated the items, and adds up the values.
When needed, other scripts can call this function.
It seems to work, but I've no idea if it is a good way of doing this.
-
Embed this notice