• Advertisement
  • entries
  • comments
  • views

Day 5(allready?): Different types of enemies

Sign in to follow this  


The game was getting kind of boring, so I added 2 types of enemies:

  • Yellow ring: Faster, rotates
  • Red shape: Shoots at you. (You have 3 lives)

    I also did some stats about how beneficial death actually is to you, and I found you usually earn 30-60 points on death, which means with the death penalty of 100 poins, you usually lose points by dying. This is a good think in my opinion, since you try not to die, but death is still usefull since it's possible to earn a few extra points during death (I got 130 once)
    I also made some speed improvements, by not rotating sprites like coins and bullets that where rotationally symmetric anyway. This also saves a lot of memory, since I was caging rotated versions of sprites.
    I changed the background music to a different song, that I feel fits the theme better anyways. This one is also loop-able, while the other one wasn't. This one screeeches to, but at least it's to a rithm, with some stuff played on top.
    I fixed a bug where the time on the screen would count down while dead, and would snap back to the internal time when coming back alive.
    I also found that the best way to get a high score is just to keep holding "Z", forward, and either right or left. This gives you 3000-4000 score depending on your luck, and almost guarantees 0 deaths. I tested this before adding the new enemies though, so hopefully a bit more skill is involved now.
    and, just to be random, is a totally random section of code:
    [spoiler]for i in range(self.lives):self.screen.blit(self.life_img,(size[0]//2-65+36*i,10))textutil.drawtextcentered(self.screen, (1180,10), self.font, "0:"+str(ltime),alignment=(2,0),color=color)else:self.screen.blit(self.splash,(0,0))if self.trans:self.screen.blit(self.transsurface,(-self.transamount,0),(0,0,size[0]//2,size[1]))self.screen.blit(self.transsurface,(size[0]//2+self.transamount,0),(size[0]//2,0,size[0]//2,size[1]))self.transamount+=15if self.transamount>size[0]//2:self.trans=Falsepygame.display.flip()def update(self):if not self.trans:if self.state=="splash" and time.time()>self.endtime:self.startmenu()del self.splashif self.state=="game" and self.player_immune:self.player_immune-=1for i in self.objects:if (self.state!="dead" or i not in self.enemies):i.update();if self.state!="dead":for en, bul in pygame.sprite.groupcollide(self.enemies, self.bullets, False, False, pygame.sprite.collide_circle).iteritems():[/spoiler]
Sign in to follow this  

1 Comment

Recommended Comments

More enemies :)

I just implemented a shooter enemy myself, think it's a good idea to challenge player positioning.

Keep up the good work!

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement