This turned out fairly straightforward, albeit a bit tedious. Mostly this was because when I built the way blocks are handled/spawned/scored in the first place, I wasn’t intending there to be an arbitrary number of unique blocks. So I had to refactor a fair bit of code to create a way to hook it up to the player’s new inventory.
The UI/panels didn’t cause me much pain this week, which is a good sign. They’re still kind of ugly, using the same old boundary artwork as everywhere else, but it’s a start.
I did have some trouble with gesture controls, though. Normally it’s pretty easy to set up a chunk of content to scroll using Unity’s ScrollRect component, as I have in the shop menu. This time I had two large-ish problems:
- Scrolling doesn’t naturally snap to units. With “full-screen” horizontal scrolling (one block visible at a time), it really needs to snap appropriately. This is a bit involved, and I’ve delayed it for a future sprint.
- My block rendering prefab is not a UI element, but an in-world SpriteRenderer element. I did this for various reasons that may no longer apply, but it remains nevertheless. The problem with this is that SpriteRenderers are not affected by normal masking, so as you swipe left/right, you see the blocks just sort of scooting into the screen without the panels behind them. There are ways to fix this, but again, a tiny bit too involved to fit in this sprint.
Since the scrolling didn’t work out, I added a couple of left/right buttons that provide the functionality for now. Like other parts of the UI that don’t show any sort of visual movement/tweening, this feels a bit too abrupt, but it will have to do for now.
All in all I’m pretty happy with this new chunk of gameplay, though it will need more support elsewhere in the game before it feels particularly meaningful.
Next up: “Pips” and Coloration
As preparation for mechanics planned for future sprints, I’ve decided to shift how planets in mining mode generate and render tiles. Currently, they’re a somewhat 2D-Minecraft-esque approximation of actual planetary soil, minerals, etc.
The change will be to partially remove the concept of real-world materials from the mining gameplay. You’ll still find gold in them thar hills, but now it’ll appear in any given generated tile as a small gold-colored circle, what I’m calling a ‘pip’. This dissociation between the material found in the tile and the color of the tile allows for future strategic gameplay around coloration.
This will also provide additional differentiation between planets – you’ll be able to tell from the starmap what sort of coloration a planet is likely to have, and eventually, tailor the set of blocks you bring with you to increase your effectiveness on that planet.