Friday, June 13, 2014

Dev Log: Horror Text Adventure #51

I fixed up the Open command a bit so now if the player tries opening a barrier without specifying a direction, it can still understand what was said.  So if the player tries opening a door, and there's only one door in the room, it works.  If there's more than one door, it asks you to specify which door you'd like to open.

Then, after seeing how simple, clean, and short the Open code was, I basically just copypasta'd the code to the Lock command, since the Lock command was getting confusing, unruly, and error-prone.  Since they essentially work the same from the point of view of the Interface class, it made far more sense to just do that, and let the Barrier class take care of the specifics.

And now knowing I've got c&p'd code, I bet there's an even better way of taking care of both and combine them.  That'll have to be during another round of code cleanup.  But at least when I figure out how to lock or open items, it'll be easy to do the other one.

Unfortunately, this post won't be as huge as the last one.  But fortunately, this week led to striking things off the to-do list, instead of adding anything.  And now that the Open and Lock code are much cleaner, I don't dread making it work for objects so much anymore.  But that part's still on the to-do list.

No comments:

Post a Comment