当前位置: 首页>>代码示例>>Python>>正文


Python Graphics.displayCardPlay方法代码示例

本文整理汇总了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)
开发者ID:ThePomelo,项目名称:Hearts,代码行数:39,代码来源:Main.py

示例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])
"""		
开发者ID:ThePomelo,项目名称:Hearts,代码行数:33,代码来源:Main.py


注:本文中的Graphics.displayCardPlay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。