Posted March 19, 2024 by Robert
I originally built it with MouseInput
only and I had a mechanic where you can hold something in your hand (mouse cursor) if you drop it on another thing.
But that doesn’t work for phones and tables, because when your finger is off the screen the game doesn’t track where your finger is.
In version v0.5 I rewrote the drag/drop code to only allow dropping in an empty slot. And it works with Touch input by default. This allowed me to add another neat feature on phones, where you can drag multiple items at a time. You have to keep track of slots that look empty but are actually being dragged in your mind though so it’s not bug free.
Now whenever you finish a level, it saves your stats, and updates the best ratio of items/clicks that you got. Then this ratio is updated as the “score” in the main menu. (see attached picture)
I’m using binary saves which is actually easier to use than JSON, less steps just dropping a Variant directly into the save file.
Looking at the save file in xxd
though shows that Variants are a bit large, so even though it’s not needed, I might change it to save a single int for section type, and then a variant for the section save data.
I’d like to have at least 55 items, and this brings the total up to 20. I admit these are all pretty lazy models. The coffee cups and boxes are easy. I added a flap on top of the cereal box. And the Chips bag is the same model as the coffee bag, and it looks like it ha ha ha.
As I mentioned in the Input section, it now runs on my iPad pretty well. Not releasing it here on itch yet. But I’m glad my kids can play it on the iPad. And they have a bit of fun playing it even in it’s minimal state right now.