After over a month of on-and-off coding, the first GUI widget is finished–the inventory widget. From a player’s point of view, there’s nothing really that innovative to it; it’s purely functional. However, from a developer’s point of view, dang that thing took a long time to make.
As I mentioned in the last few posts, the inventory widget uses both the NGUI and FingerGestures systems to provide functionality. So far, the widget (and those in the foreseeable future) can be opened and closed by swiping or by activating the toggle button. Currently the inventory slots can be clicked or tapped to toggle between two icons, which simply shows that these pieces are hooked up and ready to go for future use. Eventually the slots will be draggable so that players can rearrange, activate, and drop items easily.
For such simple functionality, there’s a crazy amount of work that goes into it:
- The whole NGUI and FingerGestures systems. It would have taken me days longer without them
- Create the grid
- Create the graphics. Luckily I’m reusing most of the graphics that come in example packages of NGUI
- Create the icons. I’ve only made this one of the lettuce, but I came up with the whole procedure for converting an in-game asset into an icon
- Make the panel and all of its children components using NGUI and the relatively complex hierarchy structure it requires
- Centering and Scaling setup
- Code a custom script to create a box collider on the parent panel of the entire GUI from all of its children in order to detect touch input
- Set up the FingerGestures environment and opening up some of the code for integration with the rest of my scripts
- Integrate the swipe input into the overall touch input controller so that it doesn’t interfere with normal GUI operations nor movement/camera controls
- Getting the position tween (the close/open sliding of the panel is called a tween) to simply work, and then extend it be called by FingerGestures’ swipe input
With that said, I still see this widget is more of a test run. Ironically, I haven’t done any wireframing or concrete planning for the actual GUI yet, despite my day job as a UI Designer, so I’m not entirely sure if this is even what I want for an inventory screen. I figure that I’ll get down to business and do some mockups in balsamiq… right after I do some fun stuff!
Next up is revisiting the terrain and using a bunch of the new cartoon assets. I’m super excited for this next development sprint!
Edit: Oh! I almost forgot, I spent a good day working on creating an actual inventory system (which is the reason why there are three random lettuce plants where you start). It’s the next piece on the route I’ve been on, and it’s coming along but it’s definitely more oriented towards some actual programming–it kind of throws me back to my java courses with a bit of a C# twist. Luckily the terrain and cartoon assets are completely unrelated, so I can easily take a break and switch my focus for a sprint or two