View Single Post
Old
Dexor
Junior Member
 
Dexor's Avatar
 
Status: Offline
Posts: 6
Join Date: Jul 2011
Location: LC,NM
Default 07-14-2011, 01:30 PM

Hi! I really like tower defense games, so this intrigued me.

A few things that I noticed right away that I hope might help you.
Of course, with all opinions on the internet, take this with a grain of salt.

1. Do not code in the event editor!
What I mean by this is, create methods that go into events so that it is cleaner to read and debug.

2. For World.monitorHealthandMoney, you call it again at the end, creating an infinite recursive loop. While this may accomplish what you are aiming for, it's a bad practice. Instead, you should use a while loop that is always updating that information while the game is running. That gives you more control over it as well.

3. You have a lot of interesting programming practices that can probably be slimmed down by taking a look at your code and seeing what actions you are repeating over and over. For example, in world.kill you, in a Do Together, check if health > 0 for multiple items, which would be the same thing as if you moved that check out of the Do Together and put it before it, removing a level of nesting.
Reason I mention this is because you asked for ways to slim it down.

4. Finally, the game crashes, due to an out of bounds exception. I'm not exactly sure where it could be happening because there is a lot of code to look through. It would be great if the code was commented.
Even if you know what the code is doing, when asking others to review your code, it's INCREDIBLY helpful to have comments stating what each part and method is doing. It's just a good practice to get into.

Hope that helps out a bit, I was looking for a good place to do my first post here, so I hope that works.
-Dx
   
Reply With Quote