Skip to content

Instantly share code, notes, and snippets.

@channel2007
Created March 30, 2020 14:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save channel2007/7f9c61bbf0ef3ddea4948183247ee395 to your computer and use it in GitHub Desktop.
Save channel2007/7f9c61bbf0ef3ddea4948183247ee395 to your computer and use it in GitHub Desktop.
那些年我們一起玩過的遊戲(二)-俄羅斯方塊 - drew.py
# encoding: utf-8
#-------------------------------------------------------------------------
# 畫Box.
#-------------------------------------------------------------------------
class Box(object):
#-------------------------------------------------------------------------
# 建構式.
# pygame : pygame.
# canvas : 畫佈.
# name : 物件名稱.
# rect : 位置、大小.
# color : 顏色.
#-------------------------------------------------------------------------
def __init__( self, pygame, canvas, name, rect, color):
self.pygame = pygame
self.canvas = canvas
self.name = name
self.rect = rect
self.color = color
self.visivle = True
#-------------------------------------------------------------------------
# 更新.
#-------------------------------------------------------------------------
def update(self):
if(self.visivle):
self.pygame.draw.rect( self.canvas, self.color, self.rect)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment