-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu_button.py
More file actions
29 lines (23 loc) · 819 Bytes
/
menu_button.py
File metadata and controls
29 lines (23 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pygame
class Menu_button(pygame.sprite.Sprite):
def __init__(self, pos, images, groups, kitty_sounds):
super().__init__(groups)
self.images = images
self.frame_image = 0
self.image = self.images[self.frame_image]
self.pos = pos
self.rect = self.image.get_rect(center = self.pos)
self.health = 5
self.type = "menu_button"
self.kitty_sounds = kitty_sounds
def hit(self):
self.kitty_sounds[0].play()
self.health -= 1
if self.health <= 0:
self.kitty_sounds[1].play()
self.kill()
self.image = self.images[1]
def get_health(self):
return self.health
def update(self, delta_t, window_w, window_h):
self.image = self.images[0]