Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- class shopp:
- def __init__(self, x, y, image, defense, cost):
- self.image = image
- self.rect = self.image.get_rect()
- self.rect.topleft = (x, y)
- self.defense = defense
- self.cost = cost
- self.clicked = False
- def draw(self, win):
- action = False
- #get mouse position
- pos = pygame.mouse.get_pos()
- #check mouseover and clicked conditions
- if self.rect.collidepoint(pos):
- if pygame.mouse.get_pressed()[0] == 1 and self.clicked == False:
- self.clicked = True
- action = True
- if pygame.mouse.get_pressed()[0] == 0:
- self.clicked = False
- #draw button on screen
- win.blit(self.image, (self.rect.x, self.rect.y))
- return action
- class suits():
- def __init__(self, part, x, y):
- self.x = x
- self.y = y
- self.part = part
- self.rect = self.part.get_rect()
- self.rect.topleft = (self.x, self.y)
- def wear(self, win):
- win.blit(self.part, (self.x, self.y))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement