Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   Share Worlds (http://www.alice.org/community/forumdisplay.php?f=6)
-   -   Tower defense game (http://www.alice.org/community/showthread.php?t=6877)

Lordcorvin 07-04-2011 05:10 PM

Tower defense game
 
1 Attachment(s)
Ok guys I made a tower defense game
Please review it's my first game

Instructions: Kill 10 heli and 10 tanks
click on target and choose a tower you want

Its easy to beat but you can increase their health in helicopter and tank properties

Please review my code and tell me if I could have shrank it down


[ATTACH]5145[/ATTACH]

Lordcorvin 07-09-2011 03:32 PM

Really no one to review?:(

InsertName 07-09-2011 03:52 PM

I'll check it out later.

Lordcorvin 07-12-2011 09:40 PM

Thanks

DensetsuNoKaboom 07-13-2011 07:18 AM

It was quite hard. The only major problem I noticed was, how do the turrets decide what to target?

Dexor 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

atrane365 05-03-2012 09:51 AM

idea
 
[QUOTE=Dexor;39113]

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. [U]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[/U], removing a level of nesting.
Reason I mention this is because you asked for ways to slim it down.
-Dx[/QUOTE]

Or, if you place (or have placed) the items in the world.kill Do Together in a list, you can do a For All Together, thereby reducing it to between 5 and 10 lines of code, instead of however long it actually is:rolleyes:

atrane365 05-17-2012 10:32 AM

i know this might not get answered, but how do you get it to where the tanks and copters still move even when they get shot?

zomdie 05-27-2012 12:15 PM

[QUOTE=Lordcorvin;38450]Ok guys I made a tower defense game
Please review it's my first game

Instructions: Kill 10 heli and 10 tanks
click on target and choose a tower you want

Its easy to beat but you can increase their health in helicopter and tank properties

Please review my code and tell me if I could have shrank it down


[ATTACH]5145[/ATTACH][/QUOTE] wt doesent work reatard

x2495iiii 05-27-2012 12:19 PM

[QUOTE=zomdie;49077]wt doesent work reatard[/QUOTE]

I'm guessing you mean "It doesn't work."

Except it does.

And how do you spell "retard" wrong? Seriously?


All times are GMT -5. The time now is 05:14 AM.

Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.