View Full Version : Another waste of time.

2nd Feb 2010, 09:10 pm
So. There's a game that has become a bit popular lately, a fairly standard tower defense game on.. whatever social networking site these kids visit nowadays.. MyBook? Spaceface? Whatever it is, a co-worker who plays it challenged me to write one (a tower defense game, not a social networking site) in AutoLISP, to run and play on AutoCAD.

... heh heh heh.

Long story short, the command is "CADDEF" and the controls are as follows:
P - Pause/Unpause (the game begins paused; unpause to start)
B - Spend Score to increase Base health
H - Toggle hover option to see buy/sell/range stats for a tower
1 - Spend Score to place block (click to select location)
2 - Spend Score to place tower (click to select location)
3 - Spend Score to upgrade tower (click to select tower)
4 - Sell block/tower and earn some Score back (click to select object)

Object of the game: waves of different types of enemies will spawn in the upper left corner and try to make their way toward your base. Place towers to destroy them or blocks to re-route them.

Tower and block placement: In order to place a tower or block, press "1" or "2" on your keyboard, then click a spot on the grid. Same operation for selling and upgrading.

The numbers need some tweaking to improve playability, however, the functions themselves seem solid. Let me know if you have any issues whatsoever.

PLEASE NOTE! The level itself is NOT drawn or set up via the game. The level (at the moment) must be set up manually, as follows:
Open new drawing
Set "LIMITS" to 0,0 - 18,13
Turn "GRID" on
Optional, but recommended - switch to 3D Wireframe mode, so grid becomes a line grid, not just a point grid. Switch background colour to black.

There are other level sizes, a 30x25, 25x20, 10x10 maze, 10x10 blank, and 50x50. Feel free to try them out; just change the line
(setq level (cadDef_mazeList 7) ...
to whatever number you want. Refer to the function (at the bottom of the code) to see which sort of level you're going to get. You'll have to update your limits each time, in order to accommodate the grid.

The stats on the game, that is to say, the enemy difficulty, tower power and scoring system, are all set up in a sort of "demo" mode; it's very difficult to lose, especially when you reach the higher levels and the score increases dramatically. The variables need to be tweaked, but I don't quite know how. Please, if you have any feedback regarding this, let me know. And yes, I am shamelessly using the people on this forum as beta testers. :oops: