Monday, May 3, 2010

Enemies 2

okay, I've made enemies, they move at the speed i want them to, and fall at the same gravity rate as my player. I had to alter my floors slightly so that i could 1: get the enemies to reappear at the same x value on the opposite side of the screen if they went off, and 2: so the enemies would miss one of the floors and work like i wanted it to.

now that I have done that, i have created 2 sets of "def spawnNewEnemies():. One for enemies spawning on the left, and one for enemies on the right. (all I had to do for the enemies on the right was make their xVel negative of what it was).

The next goal is to create a collision detection between enemies so that if they collide, they both change directions, and then do it so that if my player hits the floor underneath the enemy, the enemy will "flip" (i'll just get it to change colour for now), and then get them to die if my player hits them, or get back up(change back to original colour) if my player doesn't touch them in time, and continue on its way.

1 comment:

  1. Having two versions of spawn new enemies sounds like a lot of repeated code, Luke... is there a way to improve upon that?

    I like the change color plan for now. That seems like a good way of handling it. Perhaps you can give them a tiny upwards velocity, too, so they bounce a little - the "falling/jumping" code is already written, isn't it?

    ReplyDelete