Enemy Spawning and AI

So I am going to put aside my current trouble of creating my own tile map reading system with LibGDX and just use the standard TMX system to create a super crate box clone as my first experiment. Before I start though, I have a few questions regarding enemies.

I understand the basic enemy concept, but having a spawning and AI system is a bit difficult for me. What I would like to do is have an object that only has a position in the world and a rate at which it spawns things, and perhaps certain types it spawns. In the level creation, perhaps it would find a specific tile and set ‘new EnemySpawn(x, y, rate(f), type)’. But how do I handle it? I need a good timing system really. I’ve always had trouble understanding the best way to handle timing. At the moment I use a messy system of just using int count downs and resets.

Anyways, as for the AI. Super Crate Box has the enemies just walk off the edge of the platforms until it reaches the middle. Essentially, it just moves in a direction until it reaches a wall, where it then switches direction, all whilst gravity has its toll on the enemy.

I don’t know where I’m going with this post. I think its more or less a thought dump at this point. I also need assistance on better understanding collision handling per enemy. I understand how a player works, but for each individual enemy? Where should the collision system be stored for each of them?

Thanks!

  • A

Reference, Super Crate Box:
http://www.supercratebox.com/