Created
March 30, 2020 14:34
-
-
Save channel2007/7f9c61bbf0ef3ddea4948183247ee395 to your computer and use it in GitHub Desktop.
那些年我們一起玩過的遊戲(二)-俄羅斯方塊 - drew.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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