Creating Obstruction Cells for On Rails TDG

Nov 13, 2011 at 7:21 AM

 Hi there.  I am making an on-rails tower defense game (or I want to), but I am having trouble with obstacle cells, which I plan to use to define the path the creeps take.  Under special cells in my 1.xml file I added the following

<Cell CellId="Obstruction" Type="Obstruction" Buildable="True" X="value" Y="value" />

This doesn't seem to cause an issue when I only define one cell as having an obstruction, but when I add it for all the cells that I want the map will not load on the emulator. 

I'm just wondering where I'm going wrong.

Also, is there a less cumbersome way to add obstructions?  Do I need to add a new cell for each obstruction, or can I define multiple coordinates in the X= Y= of just 1 obstacle cell.




Nov 14, 2011 at 1:21 AM

I agree that there should be an easier way to make path tower defense games.

After all 90% of TD games are "on rails".

Maybe we could have a "path" cell that creeps have to follow instead of adding tons of obstruction cells.

Nov 14, 2011 at 6:07 AM

You need to use version 69552 or later from the source code tab to be able to specify cells without names.

The game was designed for dynamic pathfinding on an open grid with some obstructions, rather than an on-rails TD. I'm thinking about how to change things for v2, but understand that the design I received for the first version didn't include specifying paths, and the game code structure as it is now doesn't allow for it without a fair bit of effort. But this is something I *will* ensure is in v2.

Nov 16, 2011 at 5:46 AM

Hey Guys,

For anyone wanting to make their TD game on-rails, I just thought I'd offer some tips as to how I got it to work.  First off, I'm using version 70579 of the source code.  Secondly, to define obstruction cells in my .xml map files I use the following notation;

<Cell Type="Obstruction" Buildable="True/False" X="value" Y="value" />

Now, what I find works best is I load my desired background image into my map .xml file, and run the game on the emulator.  I load that level, and the grid shows up as an overlay  on my background image.  I take a screen shot, past it into Paint, and colour in all cells needed to define my path.  From this image, I extrapolate my coordinates and then input them into the .xml file.  It's a fair amount of work, depending on how intricate your path is, but it works. 

I'm a super noob so there may be an easier way to do it, but this way works and hopefully it's of some benefit to some of you.