本文整理汇总了Python中piece.Piece.setState方法的典型用法代码示例。如果您正苦于以下问题:Python Piece.setState方法的具体用法?Python Piece.setState怎么用?Python Piece.setState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类piece.Piece
的用法示例。
在下文中一共展示了Piece.setState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_game
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import setState [as 别名]
def new_game():
global gs,spaces,game_begun,done,gameover, \
turn_stage,selected_piece,hover_piece, \
attackable_pieces,credits_showing,rules_showing, \
paused,moveCounter,saved_piece,movedPieces
gs = State(cols,rows)
Piece.setState(gs)
spaces = pygame.sprite.RenderPlain()
#sets up board
for i in xrange(cols):
for j in xrange(rows/2+1):
if i%2==0:
s=Space(screenw,screenh,cols,rows,i*screenw/cols-i*screenw/cols/4,2*j*screenh/rows+50,i,j*2)
else:
if j < rows/2:
s=Space(screenw,screenh,cols,rows,i*screenw/cols-i*screenw/cols/4,2*int((j+.5)*screenh/rows)+50,i,j*2+1)
spaces.add(s)
game_begun = False
done = False
gameover = False
credits_showing = False
rules_showing = False
paused = False
# stages: piece_select, move, dir_sel, attack
turn_stage = 'piece_sel'
selected_piece = None
saved_piece = None # for cancel button
hover_piece = None
attackable_pieces = []
moveCounter = 0
movedPieces = []