I added monster to the game they like any old game they move right and left

class Enemy(pygame.sprite.Sprite):
def __init__(self, x, y):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load('img/blob.png')
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
self.move_direction = 1
self.move_counter = 0
this the class for the enemy

I add lava and made it too take damage also a game over by making it into ghost i add all the code in update class

if pygame.sprite.spritecollide(self, blob_group, False):
game_over = -1
#check for collision with lava
if pygame.sprite.spritecollide(self, lava_group, False):
game_over = -1
#update player coordinates
self.rect.x += dx
self.rect.y += dy
elif game_over == -1:
self.image = self.dead_image
if self.rect.y > 200:
self.rect.y -= 5