Monday, July 2, 2012

IT'S ALIIIIIVVEEE!!!!

Well, not really, but the pieces move!

Yesterday I spent a ton of time scripting a bear that walks to the right and attacks and dies, and a knight that walks to the left and attacks and dies, and then I realized how stupid that was and that it's actually possible to make something inherit from a monobehaviour and still function as a monobehaviour.  So I refactored my code so that "MovableUnit" is a class, and Bear and Knight both inherit from it.  Now it works exactly as it did yesterday except it's organized better.  Yeah, welcome to the glamorous world of indie game development.  Today my Bear cubes look exactly the same, but they're WAY BETTER.  Trust me.  And this means that adding a lumberjack cube that chops down trees, and adding functionality to the bear so that he sleeps until someone tries to chop down a nearby tree etc. etc. will all be SUPER EASY.

No pictures.  Just imagine the old one but with a teal cube and a white cube next to eachother, occasionally Debug.Logging "Knight Attacks Bear!" or "Bear attacks Knight!" until one disappears, and the other moves off the screen and says "I WIN!"

No comments:

Post a Comment