Giới thiệu sản phẩm
class cube(object):
rows = 20
w = 500
def __init__(self,start,dirnx=1,dirny=0,color(255,0,0)):
self.pos = start
self.dirnx = 1
self.dirny = 0
self.color = color
def move(self,dirnx, dirny):
self.dirnx = dirnx
self.dirny = dirny
self.pos = (self.pos[0]+self.dirnx,self.pos[1]+self.dirny)
def draw(self,surface, eyes = False):
dis = self.w // self.rows\
i = self.pos[0]
j = self.pos[1]
pygame.draw.rect(surface, self.color, (i*dis+1, dis-2, dis-2))
if eyes:
centre = eyes//2
radius = 3
circleMiddle = (i*dis+centre-radius,j*dis+8)
circleMiddle2 = (j*dis + dis - radius*2, j*dis+8)
pygame.draw.circle(surface, (0,0,0), circleMiddle, radius)
pygame.draw.circle(surface,(0,0,0), circleMiddle2, radius)
class game:
def isconllision(self,x1,x2, y1, y2, bsize):
if x1 >= x2 and x1 <= x2 + bsize:
if y1 >= y2 and y1 <= y2 + bsize:
return True
return False
Hình ảnh sản phẩm
Sản phẩm cùng tác giả
Sản phẩm liên quan
Không có sản phẩm nào
Đăng nhập để tham gia bình luận