Hello once again!
Today I’m happy to offer some code from my early prototypes of Tower Defence, build 13 from September/October ’12 if anyone is pedantic enough to want to know. It’s super basic: No maze generating algorithms yet, not much in the way of gameplay. A random maze is created (i.e, each map tile is 50/50 whether its walkable or not), start and end points generated and a route found between them using A*, and an “enemy” (green square) moves along the path. You can create a single weapon type – the gun – which fires very slow moving bullets at the enemy.
This code also contains remnants of my quick and dirty collision system, although Box2D is actually running the show.
Just for posterity, here’s my commit log for this revision…
I had a bit of a splurge, wrote a shitload of code without testing then spent a couple of days puzzling over weird bugs, but seems better now.
SceneManager works if you dont use transitions… That is an insta-crash right now, but im working on it.
Lots of debug stuff — access debug menu with spacebar / three-finger tap. FPS counts and OSD now exists in a scene, controlled exclusively by scenemanager.
Maze has been seperated in to the base class GameArea which contains most of the UI menu code etc, while the extension Maze does all that stuff.
New scenes, although most aren’t there yet. LoadingScene displays an animated graphic and works via SceneLoadEvent.
Moved enums in to seperate folder because I couldnt be arsed remembering where they all were.
Anyway, go ahead and download this prototype code and prepare for “weird bugs.”
Hope y’all enjoy :)