Feb 4th Post
Adding Carrots to Shrimp Game
By JAXON G February 4th, 2023, 4:19 p.m. PST
As the title says, I have added carrots to Shrimp Game, they never would've expected it but it has been done. "What are these carrots?" you may be asking and to that, I say, they are just a better version of wheat. Up until now, those have been the only type of crop that could be farmed by your shrimp workers in Shrimp Game. In case you don't know what Shrimp Game is, it's a game that I started creating in June/July of 2022. It is an incremental type game, like Cookie Clicker but it has shrimp, so it's better. It took me a few hours to get these carrot crops added. Firstly I drew the sprites for each of the growth stages of the plant objects that "grow" on the farms. (the mentioned sprites are shown below)
I drew these sprites with Aseprite, which is a paid-for pixel art creation software. After I had these I threw them into the Unity project, Unity being the game engine I use to create my games. Following that, I added some code to the ShrimpFarmObject.cs script.
Starting the code addition with just a simple bool.
And for swapping the sprites of each of the plants on the farm to the new carrot plant sprites, I just had to alter a couple of numbers. The current way the code works is I have an array of sprites, and each of those sprites has an index number for where they exist in the list of sprites. So all I did was check if the carrot bool was true, then it would just add 6 to the spots where the code sets the growth sprites. However, that being said the way I coded it isn't necessarily the best way to code. But for now, it is just a simple way to code it, and whenever I add more crops to the game then I can figure out a better way to code it. Afterward, I added a button to test the upgrading of the farms to carrot crops. When the button was pressed it would run this function.
This function runs through all the plants in the selected farm and swaps whatever growth stage sprite the plant is at to the matching growth stage sprite of the carrot type. This worked properly the first time I coded it, which is only sometimes true since I am relatively still a beginner C# coder. The swapped plants of the farm looked like this, you can also see one of the wheat farms in the background of the image.
Then I added code in the ShrimpFarmV2.cs script, which is attached to the hub object. The added code was to have the carrot crops harvested, and have a higher monetary value than wheat. The two different types of crops harvested are added to an array that has a slot for each type. The values are then shown in a little drop-down UI element that can be clicked to show the information. All the crop values are stored within the hub object, then when the hub is tapped or clicked it calls an exporter shrimp. When it arrives it grabs however much product it can hold. Then it calculates a monetary value based on how many of each type of crop are now being stored/exported by that shrimp. Currently, the exporter fills up as much as it can of wheat then if there is leftover space it will grab the remaining space in carrots. This will be changed to the opposite, where it will check from the highest value crop down to the lowest. And there we go. That is pretty much what I did to add the new carrot crops to Shrimp Game. You can find links to the game on either of the two pages below.
If you like my games and want to support the quest toward survivability consider tipping me on Ko-fi, it is greatly appreciated.