-
Notifications
You must be signed in to change notification settings - Fork 0
/
tiles.py
48 lines (28 loc) · 992 Bytes
/
tiles.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
42
43
44
45
46
47
48
import pygame
class base_tile(pygame.sprite.Sprite):
def __init__(self, pos, size):
super().__init__()
self.image = pygame.Surface((64,64))
self.image.fill((200,162,200))
self.rect = self.image.get_rect(topleft = pos)
def update(self):
pass
class Static_tile(base_tile):
def __init__(self, pos, img):
size = (64,64) #TODO
super().__init__(pos,size)
self.image = img
def update(self):
pass
class Dinamyc_tile(base_tile):
def __init__(self, pos, imgs, frame_speed):
size = (64, 64) # TODO
super().__init__(pos, size)
self.anim = imgs
self.image = imgs[0]
self.frame_index = 0
self.frame_speed = frame_speed
def update(self):
self.image = self.anim[int(self.frame_index)]
self.frame_index = (self.frame_index + self.frame_speed)
self.frame_index = self.frame_index % len(self.anim)