Tuesday, December 10, 2013

Dev Log: Horror Text Adventure #32

Rearranged code a bit so Item is a generic class and various items like Bed and Dresser and Painting are subclasses.  Had to learn how to do subclasses.  At first I got met with ~50 errors, but of course they got fixed in groups, so I didn't really need to make 50 corrections.

Also did the same thing with Rooms.

Then I got a tricky runtime error.  I spent hours searching on line and asking people about it, but like many runtime errors, it's not the piece of code that stops that's the problem, but something earlier.  I had forgotten the "new" keyword in a couple of spots, which was making me tear my hair out, thinking that for some reason subclasses weren't inheriting public functions, or somehow they couldn't be accessed through the subclass.  Of course, I had just had a similar problem of forgetting the "new" keyword elsewhere, and I fixed it easily, though the runtime error I got that time was a completely different error.  Same solution, different errors.

Well, that's all basically just background stuff that will make my coding easier (I hope), but doesn't affect too much visually.

No comments:

Post a Comment