Posts

Showing posts from September, 2023

Inventory changes and quickslots

Image
In this post, I'll be going through some changes I've made to the inventory system I talked about in my previous post. I had already limited the amount of healing items the inventory could hold. The idea was to make empty slots appear empty instead of having the default item's info (question mark icon, etc), but I decided to leave them in for now to make it clear that there is an "empty" item. Inventory with item options, info panel, and quick slots at the bottom left. Next, I wanted to disable the drag-and-drop and use the item on mouse click features. Those were replaced with pop-up options when the item is clicked. Those options include the features the drag-and-drop had: Use, Drop, Assign to a quick bar slot, and Unassign. The quick slots at the bottom left corner of the image are created within a container based on the number of desired slots. Blueprint code creating the quick slots. Assigning an item to a slot sends a reference of the item slot in the invent...

Inventory, items and looting

Image
I decided to take a break from asset creation and do something else for the game instead. I saw some interesting tutorials on inventory systems and figured I'd give it a go. Garden 2 doesn't require a complicated inventory system as it only has a couple of consumable items for the player to use. I could have probably done it by keeping track of a few variables. However, I wanted to try out a proper system especially because I plan to use most systems created for Garden 2 in my next project, which would have a lot more items. I chose to follow a tutorial series by  LeafBranchGames  since their tutorials are well-explained and easy to implement in projects. The inventory would be a grid that would fill up slots in order to check if the item to be added should be added to an existing slot or in a new one. Similar inventories can be found in games such as Minecraft or World of Warcraft. The system created in the tutorial wasn't exactly as I had planned to do Garden 2's inve...

Sprite and direction

Image
In the previous Unreal Engine project I had an arrow component attached the to character to determine in which direction to shoot projectiles. However, the sprite would only face left or right. With Garden 2's 8-directionality I had to figure out how to rotate the arrow properly since the animations themselves don't rotate the character.  So I added a piece of code to set the rotation of the arrow component when movement input is detected. The code to rotate the arrow component. With this, the arrow ended up always pointing to the right of the character. I figured this happens because the arrow's default rotation of 0 degrees points to the side, so I needed to default the arrow's rotation to -90 degrees. The arrow is always pointing right of the character. To do this I created a cube in which the arrow is anchored as a child and added the desired rotation to the arrow component's transform. Then instead of rotating the arrow, the cube is rotated and the arrow rotate...