I was wondering how could I make a start and a death screen in pygame any help is appreciated thank you!
here is my code right now script
this is a object when ever my player collides I lose -1 health and if my heatlh is > -6 I want it to load a death screen and then when you click space or something it takes my player back where I started something like that and also how could I make an opening?
# health players
for dice in dicing:
if playerman.rect.colliderect(dice.hitbox):
hurtsound.play()
if playerman.health > -6:
playerman.health -= 1
playerman.x = 10
and here is my player class
class player:
def __init__(self,x,y,height,width,color):
self.x = x
self.y = y
self.color = color
self.height = height
self.width = width
self.speed = 5
self.isJump = False
self.JumpCount = 10
self.fall = 0
#hit box
self.hitbox = (self.x + 20, self.y, 28, 60)
self.stand = pygame.image.load("stands.png")
self.rights = [pygame.image.load("L1.png"),
pygame.image.load("L2.png"),
pygame.image.load("L3.png"),
pygame.image.load("L4.png"),
pygame.image.load("L5.png"),
pygame.image.load("L6.png"),
pygame.image.load("L7.png"),
pygame.image.load("L8.png"),
pygame.image.load("L9.png"),
pygame.image.load("L10.png"),
pygame.image.load("L11.png"),
pygame.image.load("L12.png"),
pygame.image.load("L13.png"),
pygame.image.load("L14.png"),
pygame.image.load("L15.png")]
self.lefts = [pygame.image.load("e1.png"),
pygame.image.load("e2.png"),
pygame.image.load("e3.png"),
pygame.image.load("e4.png"),
pygame.image.load("e5.png"),
pygame.image.load("e6.png"),
pygame.image.load("e7.png"),
pygame.image.load("e8.png"),
pygame.image.load("e9.png"),
pygame.image.load("e10.png"),
pygame.image.load("e11.png"),
pygame.image.load("e12.png"),
pygame.image.load("e13.png"),
pygame.image.load("e14.png"),
pygame.image.load("e15.png")]
self.standingright = [pygame.image.load("d1.png"),
pygame.image.load("d2.png"),
pygame.image.load("d3.png"),
pygame.image.load("d4.png"),
pygame.image.load("d5.png"),
pygame.image.load("d6.png"),
pygame.image.load("d7.png"),
pygame.image.load("d8.png"),
pygame.image.load("d9.png"),
pygame.image.load("d10.png"),
pygame.image.load("d11.png"),
pygame.image.load("d12.png"),
pygame.image.load("d13.png"),
pygame.image.load("d14.png"),
pygame.image.load("d15.png")]
self.standingleft =[pygame.image.load("s1.png"),
pygame.image.load("s2.png"),
pygame.image.load("s3.png"),
pygame.image.load("s4.png"),
pygame.image.load("s5.png"),
pygame.image.load("s6.png"),
pygame.image.load("s7.png"),
pygame.image.load("s8.png"),
pygame.image.load("s9.png"),
pygame.image.load("s10.png"),
pygame.image.load("s11.png"),
pygame.image.load("s12.png"),
pygame.image.load("s13.png"),
pygame.image.load("s14.png"),
pygame.image.load("s15.png")]
self.rights = [pygame.transform.scale(image,(image.get_width()//5,image.get_height()//5)) for image in self.rights]
self.lefts = [pygame.transform.scale(image,(image.get_width()//5,image.get_height()//5)) for image in self.lefts]
self.standingright = [pygame.transform.scale(image,(image.get_width()//5,image.get_height()//5)) for image in self.standingright]
self.standingleft = [pygame.transform.scale(image,(image.get_width()//5,image.get_height()//5)) for image in self.standingleft]
self.bo_index = 0
self.anim_index = 0
self.stans_index = 0
self.direction = "right"
self.direction = "left"
self.direction = "standright"
self.direction = "standleft"
self.health = 10
self.hitbox = (self.x + -30, self.y + 0, 31, 57)
# playerman hitbox
self.hits = (self.x + 20, self.y, 28,60)
self.rect = pygame.rect = pygame.Rect(self.x,self.y,width, height)