Friday, April 23, 2010

Spawn Bombs

Will you help me celebrate my non-programmer victories? I've had random levels working for awhile, but all of my baddies spawn from one point in the environment, lazily pursuing you. I wanted to implement random spawning, but wasn't looking forward to establishing several spawn points in each randomized block, partly because I presumed the system would change down the line, and then I'd have to go from block to block, deleting all of the potential locations an enemy would appear. My solution was spawn bombs.

One spawn bomb is placed in each random block, and at level start, "explodes" raycasts in random directions, dropping enemy points wherever a hit is detected. Enemies spawn at these points as the player walks through the level. Now I enjoy random levels with dense populations of randomly positioned baddies, and all it took was one bomb per random level block. Yay!

3 comments: