-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoints.py
More file actions
38 lines (30 loc) · 933 Bytes
/
Copy pathPoints.py
File metadata and controls
38 lines (30 loc) · 933 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
30
31
32
33
34
35
36
import pygame
from random import *
#Defineerime värvid
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
YELLOW = (255, 255, 0)
BLUE = (0, 0, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
PURPLE = (255, 0, 255)
class Points(pygame.sprite.Sprite):
def __init__(self,x,y):
""" Constructor funktsioon """
# Kõrgema konstruktori kutsumine
super().__init__()
# Laius,kõrgus
self.img_file = "./sprites/points/coinGold.png"
self.image = pygame.image.load(self.img_file)
self.image = pygame.transform.scale(self.image, (30,30))
self.rect = self.image.get_rect()
self.rect.y = y
self.rect.x = x
def randcolor(self):
return choice([YELLOW, BLUE, GREEN, RED, PURPLE])
def check(self,walls):
for block in walls:
if pygame.sprite.collide_rect(self, block) == 1:
return 1
else:
pass