29 Oct 2019 - vidya
Chop it down, smash it! Bring it all down!
In games like Stardew, tilling and planting seeds is crucially important. But where can you plant your seeds if your farm is overgrown with weeds, trees, and miraculously-regenerating rocks?! After figuring out tilling the soil, I knew the next thing I needed to do was the destruction of these pesky natural obstructions.
The functionality was quite similar to my initial combat setup. Despite each object being confined to a single tile, after some testing I knew that I wanted the targeting of these objects to happen based on world-space collisions. Sure, it wouldn’t be pixel perfect, but it would be more real-feeling than a grid-based destruction! I realized at this point that different effects were going to target different things: tiles, their contained objects, or world-space objects like enemies/NPCs! That’s a lot of differing options, so I went ahead and created an abstract TargetingSolution class. Its two primary children are TileTargetingSolution and EntityTargetingSolution, the former selecting Tiles based on grid positions, and the latter selecting Unity GameObjects based on their world space.
I then needed to set up different WorldObject targeting parameters, like if it’s an enemy or a harvestable object, and of what type in these categories. What I currently have could probably use some restructuring to be a little cleaner, but hey–it works!!
I still need to create an axe sprite
Not sure what I’ll be working on next, there’s still very much to do…