diff --git a/arctic-masher.py b/arctic-masher.py index 9fbf4c6..19fca3b 100644 --- a/arctic-masher.py +++ b/arctic-masher.py @@ -32,11 +32,11 @@ def main(): (pygame.K_e, "ne"), (pygame.K_d, "e"), (pygame.K_c, "se"), - (pygame.K_x, "s"), + (pygame.K_s, "s"), (pygame.K_z, "sw"), (pygame.K_a, "w"), (pygame.K_q, "nw"), - (pygame.K_s, "p"), + (pygame.K_LSHIFT, "p"), ], )) players["2"] = (Player( @@ -117,8 +117,8 @@ def main(): screen.blit(frame_4, ((tile*spot.x)+2, (tile*spot.y)+2)) elif isinstance(spot, Player): screen.blit(frame_0, ((tile*spot.x)+2, (tile*spot.y)+2)) - scoreSurface = game_font.render(f'{spot.id}: {spot.kills}', False, black) - screen.blit(scoreSurface, (300*int(spot.id), screen_height - bottomBarHeight + 20)) + scoreSurface = game_font.render(f'player {spot.id} kills: {spot.kills} lives: {spot.lives}', False, black) + screen.blit(scoreSurface, (500*int(spot.id) - 400, screen_height - bottomBarHeight + 20)) pygame.display.flip() clock.tick(60) diff --git a/enemies.py b/enemies.py index 5dc26f0..e93020d 100644 --- a/enemies.py +++ b/enemies.py @@ -21,7 +21,7 @@ class Enemy: self.id = id self.x = x self.y = y - self.AITime = random.randint(150, 200) + self.AITime = random.randint(350, 600) self.ENEMY = True diff --git a/mapgen.py b/mapgen.py index 24ad3d6..8526e6e 100644 --- a/mapgen.py +++ b/mapgen.py @@ -22,7 +22,7 @@ def generateMap(): except Exception as error: continue - for i in range(25): + for i in range(60): for j in range(50): try: spot = [random.randint(0, tileCountx - 1), random.randint(0, tileCounty - 1)] diff --git a/player.py b/player.py index 0c41fc9..24ca707 100644 --- a/player.py +++ b/player.py @@ -12,6 +12,7 @@ class Player: self.pull = False self.PLAYER = True self.kills = 0 + self.lives = 3 commands = { "n": lambda: self.move(0,-1), @@ -74,4 +75,21 @@ class Player: raise Exception("Cannot push other players.") def die(self): - del players[self.id] \ No newline at end of file + maxTries = 5 + for i in range(maxTries + 1): + if self.lives < 1: + del players[self.id] + break + if i == maxTries: + raise Exception("No spots found for player!") + try: + spot = [random.randint(0, tileCountx - 1), random.randint(0, tileCounty - 1)] + if gameMap[spot[0]][spot[1]]: + raise Exception("spot taken!") + gameMap[spot[0]][spot[1]] = self + self.x = spot[0] + self.y = spot[1] + self.lives -= 1 + break + except Exception as error: + continue \ No newline at end of file