parent
f95ca8856c
commit
438e0652fc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,27 @@
|
||||
import pygame
|
||||
from .. import tools,setup
|
||||
from .. import constants as C
|
||||
|
||||
class Brick(pygame.sprite.Sprite):
|
||||
def __init__(self, x, y,brick_type,color=1):
|
||||
pygame.sprite.Sprite.__init__(self)
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.type = brick_type
|
||||
bright_rect_frames = [(16,0,16,16),(48,0,16,16)]
|
||||
dark_rect_frames = [(16,32,16,16),(48,32,16,16)] # 抠图
|
||||
|
||||
if not color:
|
||||
self.frame_rects = bright_rect_frames
|
||||
else:
|
||||
self.frame_rects = dark_rect_frames
|
||||
|
||||
self.frames = []
|
||||
for frame_rect in self.frame_rects:
|
||||
self.frames.append(tools.get_image(setup.GRAPHICS['tile_set'],*frame_rect,(0,0,0),C.BG_MULTI)) # 遍历加载图片
|
||||
|
||||
self.frame_index = 0
|
||||
self.image = self.frames[self.frame_index]
|
||||
self.rect = self.image.get_rect()
|
||||
self.rect.x = self.x
|
||||
self.rect.y = self.y # 设置坐标与图片
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue