Categories
Projects

BattleGrid – UI (Continued)

The switch to the “select a cell, then a structure” UI when building structures looks and works great. There’s only one problem: not all my structures fit in a 1×1 cell. Some structures are 2×2, some are 3×3. The new UI still worked for these sizes of structures, but didn’t feel right. For 3×3 structures, the tile you picked is in the center of the structure, which is OK. For 2×2 structures, though, the tile you picked is the upper-right of the 4 tiles. I lack a screenshot, so this will have to do:

New build menu, showing the problem with 2x2 structures
The problem with the new build menu

I liked the new UI too much to switch back, though. It felt right, even if it wasn’t working great yet. So I did some more thinking, added a bunch of code, and a few iterations later I have things working pretty well. The only downside is that building requires one extra tap/click. However, requiring that extra tap works out pretty well.

When you tap a cell, the build menu appears. When you select a structure, the game finds the appropriate position closest to the tile you selected and places the structure there. Then the camera re-centers on the structure. For 1×1 (or 3×3) structures, there’s no change (though I might add a slight zoom-out if you’re too close for 3×3 structures), but for 2×2 structures, the camera will line up on the intersection of the 4 cells:

New build UI for 2x2 structures
Building an outpost.

If the location is valid, the cells with light up green. If not, the invalid cells will light up red:

The new build UI for 2x2 structures when the location is invalid
Invalid outpost placement

If all the cells are green, you can tap the structure, and it will start building. The part that works out well with the switch is that you can select a structure, and if the location is invalid, you can use the standard camera control gestures (swiping and pinching) to pan and zoom the camera. The structure you’re working on will stay centered the whole time, and when you’ve moved to a good position, you can tap it to build it. This is an improvement over the old UI, where you’d tap a structure and you could drag it around, but you lost control of the camera, so the structure had to go somewhere within the camera’s view when you selected the structure.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.