forked from Datrags/math10Final
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheart.py
More file actions
18 lines (18 loc) · 659 Bytes
/
heart.py
File metadata and controls
18 lines (18 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#Heart class by Stephan Green
#Inherits from pygame's sprite class
#Used to display full/empty hearts for a game.
#8/12/2021
import pygame
class Heart(pygame.sprite.Sprite):
def __init__(self, a, i, th,x,y): #a = activeheart i= inactive heart
super().__init__()
self.active_sprite = pygame.image.load(a)
self.inactive_sprite = pygame.image.load(i)
self.image = self.active_sprite
self.rect = self.image.get_rect()
self.total_hearts = th
self.rect.topleft = [x,y]
def set_inactive(self):
self.image = self.inactive_sprite
def set_active(self):
self.image = self.active_sprite