I continued to focus on the workers last week.
Sprint 32: Worker polish and training levels
Planned and Completed:
- Animate worker putting down toy
Planned and Uncompleted:
- Make worker eyes follow to nearest toy on belt
- Move toy parts towards inventory
- Create floor training levels/tutorial
After adding some simple yet effective enhancements to the toy movement that I thought made the game a lot more enjoyable to experience, I thought it seemed odd that the workers continued to stay stationary, so I thought I should do something.
Early in the week I managed to separate the arms from the workers, and I created a way to rotate the arms based on time relative time it takes for a toy to move.
But first, I had some fun with them. You know, to test it out:
Ultimately, I ended up creating a specific motion for the arms to flip toys into the air, which works for both throwing separated toy parts into the inventory and throwing a crafted Good Toy onto the conveyor belt.
Before I could work on anything else, I found that there was a strange flicker with the arms that occurred if there were multiple workers. It took a bit of investigation, but the arms animate if the worker has finished either crafting a Good Toy or separating a Bad Toy. Crafting and separating happen at the same time, but toy parts will go into the inventory first, then Good Toys will be thrown onto the conveyor belt.
All well and good, except I reuse the same variable to manage a timer to move toys in each step, and I reused that same timer to manage the rotation of the arms.
Now, each step only occurs if it needs to. That is, if there is no worker putting down toys, then those sequences and the use of the timer for those sequences won’t happen.
So when you have one worker, or when you have multiple workers who all finish separating toys at the same time, nothing goes wrong, but when you have multiple workers who aren’t doing the exact same thing at the same time, then the timer, which governs the rotation of the worker’s arms, rotates the arms during an irrelevant step. It was too easy for things to go wrong due the overuse of a single variable.
So, for example, a worker who just finished separating toys will launch the toy parts into the inventory, raising their arms and lowering them back down based on the same timer that is moving the toy parts into the inventory. But then that same timer starts over for the next phase, and so that worker will raise their arms again even though they shouldn’t.
In the end, I ended up adding more states for the worker to represent when they “celebrate” finishing the job of separating or crafting a toy, and it made it easier to manage. The arms only animate when the worker is in one of those celebration states, and immediately after that animation ends, I change the worker’s state so that they don’t animate the arms anymore.
The next thing I started to look at was changing what happens to separated toy parts. Currently, they fall offscreen, but I think it would be more intuitive if they were thrown at the inventory on the right side of the play area. So a small bear head would get thrown at the small bear head inventory icon, and perhaps it would animate to really make it clear that the small bear head quantity is going up.
It turns out that it would take quite a bit of work to change the static inventory widget that only redraws when there is a potential for the inventory numbers to change, and I ran out of time to work on it this past week. I expect to get it done early this coming week.
I didn’t purposefully mean to do any work on creating the training levels, but between having new worker types and testing their animations, I ended up playing through a few different sessions and figuring out that I actually have a fairly enjoyable game coming together, even with it being unbalanced. I need to create a solid set of levels before I release it to the world, but it’s exciting when you realize that you got distracted from testing something because the game itself distracted you.
Thanks for reading!
Want to learn when I release updates to Toytles: Leaf Raking or about future Freshly Squeezed games I am creating? Sign up for the GBGames Curiosities newsletter, and get the 24-page, full color PDF of the Toytles: Leaf Raking Player’s Guide for free!