Starting on the categories

8
Official Construct Team Post
Laura_D's avatar
Laura_D
  • 22 May, 2020
  • 411 words
  • ~2-3 mins
  • 947 visits
  • 0 favourites

So, I’ve been back into the inventory tests this week. It’s mostly been adding the functions to tidy up my events and add the basic scrolling/page mechanic. It’s still in a VERY rough state, but there is now some semblance of a category/pages system! I would attach an image, but there really is nothing interesting to show yet.

A bit of background on some decisions I’ve made that I may not have mentioned. Each inventory category is contained in its own array – it could probably be done in a single array, but my skills with arrays are somewhat limited. So I have six arrays, which will currently just store the item IDs for each item stored in a category. I could probably also use them for storing how many of an item we have, but I'll get to that later I'm sure. One array problem at a time!

These arrays are all grouped into a family, with an instance variable to tell the project which category each array is for. Then hopefully I can use the size of the array to work out how many pages there are in each category.

So. Onto the category mechanic itself.

Essentially, the way the categories etc. will work is similar to the inventory system in Breath of the Wild (see my research post if you’ve not played BotW before, or just fancy a read.) When you reach the edge of your current inventory page, the project will check if there’s another page of items to display. If there is a ‘next page’ (dictated by the size of the category’s array) then the page number variable will change, and the next batch of items will be shown. If there is no next page, then the category will switch, and the items updated accordingly.

The events are bulky and a bit broken, but the basic implementation is there. Looking through the debugger, you can see the variables change as we scroll through the inventory which is a good start. I need to make sure that the cursor still aligns properly and that the item slots update correctly too, but I’m happy with this starting structure. It shouldn't be too difficult to build on and tidy up when I've got it sorted. Feels like progress!

Once I’ve got the inventory display and navigation in correctly, I can start to look at how we actually add items to the inventory. And that’ll be… fun. I think.

Subscribe

Get emailed when there are new posts!

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!