(Airship Trader) Dev Blog #3 - Flying Sheep and Other Problems
This last few days, I created a pickup and inventory system that works with my weight distribution feature.
As I mentioned in the last devlogs, I had never built a drag-and-drop inventory before. As a beginner, this turned out to be quite a bit more challenging than I expected.
I found this really helpful and well-made resource by Tomodi, which gave me a great starting point:
https://www.youtube.com/watch?v=jERAHgseeIg
The tutorial itself was relatively straightforward to follow. The real struggle started afterwards, when I had to figure out how to adapt the system to my own game.
Of course, I also wanted to add my own extra functionality. Because apparently making things harder for myself is part of the process.
There was a lot of reading, experimenting, tweaking and breaking things along the way. There were also a quite a few moments where I begrudgingly asked AI for help when I couldn't figure something out.
Eventually though, I managed to get it into a shape that works for my game at this stage. I've also added a pickup mechanic using a hook. The idea is that you extend the hook from the airship, catch a crate, and then reel it back in towards the ship. Once the crate reaches the ship, it gets transferred into the appropriate inventory. I've got it working with a static body for the crate.
This is the part that finally makes the cargo system feel connected to the airship itself. Instead of just moving items around in an inventory, you actually have to get the hook to the crate, bring it back to the ship, and then decide where the cargo should go.

At the moment, I have three different inventories:
Inventory One - A small number of slots for items being picked up. This prevents the player from picking up an endless number of crates without actually storing them somewhere.
Left Storage - Items stored here add their weight to the left side of the airship and affect its tilt.
Right Storage - Same thing, but for the right side.
So the inventory is now connected to the weight distribution system I built earlier with the button prototype. Instead of pressing buttons to change the weight, the actual cargo now does it, which is considerably more useful.
The system from the tutorial is also quite flexible. I can have multiple inventories and move items between them, which is exactly what I need for my storage system.
Eventually, I want the storage system to have each crate affect the airship's torque depending on where it is stored, so the position of the cargo directly influences how much it tilts. The further a crate is from the center of the ship, the more torque it creates; the closer it is to the center, the less it affects the tilt. Thats something for later, though.
Moving Sheep


Once I had the basic system working in a prototype, I thought it would be fun to add a variation to the crates - a moving sheep. Because obviously, if I can pick up a crate, the next logical step is livestock.
The sheep can walk around and otherwise work just like the crates. Cute little sheep, wandering around and waiting to be picked up by an airship. They struggle with curved surfaces, though.
The hook was able to catch the sheep just as the crates, and bring it into storage.
Everything was working fine. Until I added physics.
Yes, I know.
It makes things considerably more complicated, but I don't want my pickups to just float in the air when I let go of them. I want them to actually fall down and interact with the world.
And this is where things started getting a little tricky. I’m still not entirely comfortable with coding. Not by a long shot. When something like this breaks, it can be pretty frustrating when I don’t always know where to start looking. I’ve been trying to use tutorials, documentation, forums and other resources to figure things out myself, and only ask for help when I’m really stuck. It’s definitely slower that way, but I feel like I actually learn something in the process.
Then There Was the Hook
The physics also created a new problem with the hook. The hook is supposed to pick up crates and sheep, and it was working before. It now kicks them away. Apparently, once physics entered the picture, collision was no longer just something I used to check whether the hook had hit something. Now collision actually does physics things.
Who knew.
So now I am trying to figure out how to make the pickup system and physics play nicely together without breaking everything else. And hopefully convince my hook that it is supposed to pick things up, not launch them. Simply deactivating the collision shape doesn't solve the problem, as the hook now doesn't know how to pick up a crate. Playing with collison layers and masks and groups hasn't resolved the issue yet, either.
If you have any helpful pointers or know of a good resource for dealing with something like this, I would definitely appreciate it!
In the meantime, I have a sheep to catch. Somehow.
If you are enjoying my content, please let me know, as this is the first ever devlog I am doing.
Follow the game and come aboard for the voyage!
I’m also happy to hear your feedback!
Discussion