Wednesday, June 27, 2007

Collision Detection, Grid

I've finished the collision detection for the drag n' drop. I must tell you that it wasn't easy. What began as some simple, easy code for the grid became an overblown messy nightmare. When it was basically complete, I realized that coming back to it to fix bugs and whatnot would take more patience than I have, so I created a reusable function that simplifies my work with the grid. Whenever I need to perform operations on multiple grid squares, particularly a line (all grid squares that a route passes through) of them, All I have to do is pass a few bits of info to the function and a delegate linking to the operation I want to perform.

I can't tell you how convenient this makes things. However, though simplified somewhat from the original, the new function is still long and chaotic. I'm waiting for some problems to surface. Later on, I might even come back and run through it line by line to find any minimal glitches. For now, however, I'm going to shift my focus to collision detection for growing routes to see whether they intersect with any enemy routes.

After that, I hope to start on the fog of war.

Comment, please. Say hi if nothing else, just so I know someone's reading.

clevceo

No comments: