-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassMenu.py
41 lines (39 loc) · 1.49 KB
/
classMenu.py
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
30
31
32
33
34
35
36
37
38
39
40
41
import pygame
class Menu(pygame.sprite.Sprite):
def __init__(self, pos):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((440, 120))
self.image.fill((255, 255, 255))
self.image.set_colorkey((255, 255, 255))
#self.image.set_alpha(50)
self.rect = self.image.get_rect()
self.rect.center = pos
ramka = pygame.image.load('ramka.png')
ramka = pygame.transform.scale(ramka, (440, 120))
turelimage1 = pygame.image.load('turel1.png')
turelimage1= pygame.transform.scale(turelimage1, (80, 80))
turelimage2 = pygame.image.load('turel2.png')
turelimage2 = pygame.transform.scale(turelimage2, (80, 80))
turelimage3 = pygame.image.load('turel3.png')
turelimage3 = pygame.transform.scale(turelimage3, (80, 80))
turelimage4 = pygame.image.load('turel4.png')
turelimage4 = pygame.transform.scale(turelimage4, (80, 80))
ramka.fill((255,255,255))
self.image.blit(ramka, (0,0))
self.image.blit(turelimage1, (20, 20))
self.image.blit(turelimage2, (120, 20))
self.image.blit(turelimage3, (220, 20))
self.image.blit(turelimage4, (320, 20))
def turelchoice(self, pos):
mposx, mposy = pos
rx = mposx - self.rect.x
if 20<rx<120:
return 1
elif 120<rx<220:
return 2
elif 220<rx<320:
return 3
elif 320<rx<420:
return 4
else:
return 0