Items
Author: Xavier Williams
Problem:
A problem I had this sprint was adding items that need to spawn in an actor. This is because the item system uses actors win an interact interface toe picking up an item, and objects with a use function in them that is called when the player uses their item. Since the use function for all items is stored in an object, items that need to spawn in an actor require extra steps to implement because of objects not being able to call the function for spawning actors.
Solution:
To solve this problem, I added a check in the player function for using items that checks if the item that is about to be used is one of the items that needs to spawn an actor. If it is, it goes into a function that is also in the player that spawns whatever the actor is, skipping the call to the use function in the object. To make this more efficient later, instead of checking for each item that needs to do this individually, I will add bool for if it needs to skip the use function, and an actor class reference for the actor that needs to be spawned to the struct that already contains the variables for the items.
Comments
Post a Comment