本文整理汇总了Python中Graphics.displayCardPlay方法的典型用法代码示例。如果您正苦于以下问题:Python Graphics.displayCardPlay方法的具体用法?Python Graphics.displayCardPlay怎么用?Python Graphics.displayCardPlay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphics
的用法示例。
在下文中一共展示了Graphics.displayCardPlay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handleInput
# 需要导入模块: import Graphics [as 别名]
# 或者: from Graphics import displayCardPlay [as 别名]
def handleInput(hand,selection,state,play_made):
# temporary value should throw error if unchanged
card = 52
#wait for keypress
keypress = wait()
# check for QUIT events
for event in pygame.event.get(QUIT):
#end the game
state = False
if keypress == K_ESCAPE:
#end the game
state = False
if keypress == K_RETURN and len(hand)>0:
#display player's played card
card = hand.pop(selection)
graphics.displayCardPlay(card,0)
play_made = True
#if we select the last card, we must decrement selection,
#since the hand is now one card fewer
if selection == len(hand):
selection -= 1
if keypress == K_LEFT and selection > 0:
#move the selection left
selection -= 1
if keypress == K_RIGHT and selection < len(hand)-1:
#move the selection right
selection += 1
return (hand,selection,state,play_made,card)
示例2: card
# 需要导入模块: import Graphics [as 别名]
# 或者: from Graphics import displayCardPlay [as 别名]
#check what has been played so far
sofar = [52,52,52,52]
point_total = 0
#each person plays a card (and loops through turn)
for m in range(4):
if m == 0:
leader = turn
#print str(turn) +" " + str(Players[turn].hand)
if turn == 0:
(players[0].hand,state,card) = playerTurn(players[0].hand,state)
if not state:
pygame.quit()
sys.exit()
else:
card = players[turn].playCardAuto(sofar)
graphics.displayCardPlay(card,turn)
sofar[turn] = card
turn = (turn+1) % 4
point_total += CardClass.pointValue(card)
graphics.displaysurf.blit(graphics.frame, (0,0))
pygame.display.update()
fpsclock.tick(1)
turn = CardClass.winner(sofar,leader) #indicate who wins the trick
score[turn] += point_total
fpsclock.tick(1)
"""
print "scorer for trick %d" % (i+1)
#Print scores out for each player
for p in range(4):
print "player %d: %d" % (p+1, score[p])
"""