-
Notifications
You must be signed in to change notification settings - Fork 0
/
inventaire.py
36 lines (27 loc) · 1.36 KB
/
inventaire.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
import pygame
class Inventaire(pygame.sprite.Sprite):
def __init__(self, rectX, rectY, listeItem, game):
self.image = game.images.inventaire
self.listeItem = listeItem
self.rect = self.image.get_rect()
self.rect.x = rectX
self.rect.y = rectY
for i in range(len(listeItem)):
listeItem[i].rect.x = self.rect.x+14+60*i
listeItem[i].rect.y = self.rect.y+12
def blitInventaire(self, fenetre, joueur):
fenetre.blit(self.image, (self.rect.x, self.rect.y))
for i in range (len(self.listeItem)) :
##changer les alpha
if joueur.cout(self.listeItem[i]):
self.listeItem[i].image.set_alpha(255)
fenetre.blit(self.listeItem[i].image, (self.listeItem[i].rect.x,self.listeItem[i].rect.y))
else :
self.listeItem[i].image.set_alpha(100)
fenetre.blit(self.listeItem[i].image, (self.listeItem[i].rect.x,self.listeItem[i].rect.y))
def loadInfoBulle(self, source = "data/menu/infoBulleBatiment"):
imgTemp = pygame.image.load(source).convert_alpha()
return imgTemp
def blitInfoBulle(self, fenetre, item):
if item.infoBulle :
fenetre.blit(item.infoBulle,(item.rect.x-175, self.rect.y-260))