Skill Tree Activated

The quest to become an indie game developer

#100DaysOfCode#100DaysOfGameDevC#Illogical BaconPanic RoomScript-writingUnityVisual Studio

Room Ac Analyzer

#PanicRoom Day 100

#100DaysOfGameDev R2D65
#100DaysOfCode R2D65

crop analyst typing on laptop while working with graphs

Now that the lastRoom variable tracks what room was last made it’s easier to track the flow of room splitting and creation. When room Aa is split into two I now have it set up so that room Ab becomes the new split and room Ac is defined as the old room Ab. So what happens when a split needs to happen on the other side of the initial room block A dividing wall, the old room Ab and new room Ac?

This is where the new room Ac analyzer comes in. Room Ac can come into existence whenever room Aa gets divided or room Ab gets divided. In either case I needed to account for this new split and have a new room Ad created, which is exactly what this new block of code does.

room Ac analyzer
overjoyed employee throwing papers in air after completing paperwork

The room Ac analyzer works the same way as previous iterations and compares the size of this room against the size of the previous room as well as itself. If either of those comparisons exceeds given parameters, then a room split is called for and a new room is created.

At this point in my code, this is as far as room splitting will go, it ends with room Ad. If for some reason I decide in the future that more room splits might be needed then I will simply go in at this point and write more room analyzers and extend the splitting capabilities of the HouseBuilder script. I think this will account for 99% of most conditions, so I am moving on.

Leave a Reply

Your email address will not be published. Required fields are marked *