Day 14: Entity / Management System, Bug Fixing, And Mechanics Work

Hey all, what’s up? Part of the reason I haven’t been posting much on here as of late involves my work schedule changing. Since one of my coworkers is going on vacation this month, I’ve been working alot more hours than normal and some of my real-life has gotten in the way a bit. I hope to have a functional game by the end of the week. Then, I can start doing stuff like working on menu screens, score systems, maybe trying to update the graphics, etc. Enjoy!

Here’s a screenshot of what I’ve gotten done so far (these are just placeholder images, by the way) since the last time I posted:

HexagonGame-10-14-2013-939

 

I may not seem like I’ve done much which this project from a visual side of things, but if you saw the original code vs the new code, you would probably smack me since there wasn’t any kind of structure or form to it and it was really messy (which lead to bugs when I started doing more than drawing the Hexes on the screen).

First, I created an Entity interface with an AbstractEntity class that would contain methods that would load Textures, create Actors, and manipulate those Actors (translate, rotate, resize, etc.).

Then, I created the Ingredient and Candy interfaces that both have their own individual Abstract classes that are also extensions of the AbstractEntity class since both the Candy and Ingredients used to make that Candy are going to be displayed on the screen.

Lastly, I created a Manager interface and AbstractManager class that contain methods to group together all like Entities and create them all at the same time so that the Main class (this time, it’s actually all being run through a Screen class instead of the main one), contains the least amount of code possible.

By implementing these new systems, I was able to compress quite a bit of the code down to only what’s needed for each class and also was able to track down and get rid of some bugs that were caused because of bad and messy code.

Tonight, I implemented a randomization method into the IngredientManager class that will attach a random Ingredient to each Hex on the screen, as seen above.

The next steps, attach each Ingredient to whatever Candy needs them with a specified amount, allow selection of individual Ingredients with the mouse, change the color of only the Hex that the Ingredient is on, and several other mechanics.