本文整理汇总了Python中Board.blitme方法的典型用法代码示例。如果您正苦于以下问题:Python Board.blitme方法的具体用法?Python Board.blitme怎么用?Python Board.blitme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board.blitme方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Checkers
# 需要导入模块: import Board [as 别名]
# 或者: from Board import blitme [as 别名]
class Checkers(object):
def __init__(self, screen, size, users, end):
self.screen = screen
self.size = size
self.users = users
self.teamA = Check_Team(users[0])
self.teamB = Check_Team(users[1])
self.active_team = self.teamA
self.dormant_team = self.teamB
self.active_team.set_check(self.screen, False, self.dormant_team)
self.dormant_team.set_check(self.screen, True, self.active_team)
self.active_team.active()
self.dormant_team.dormant()
self.winner = None
self.phase = None
self.width = size[0]
self.height = size[1]
self.board = Board(self.screen, (self.width/2, self.height/2), "Checkers")
self.bars = []
self.buttons = []
self.end = end
self.bars.append(Acc_Bar(self.screen, (self.width - 150, self.height - 75), self.active_team.user))
def swap_teams(self):
temp = self.active_team
self.active_team = self.dormant_team
self.dormant_team = temp
self.active_team.active()
self.dormant_team.dormant()
self.disp_user()
def disp_user(self):
x = 1
num = 1
for u in self.users:
if(u == self.active_team.user):
num = x
x += 1
a = 0
b = 0
if((num == 2)or(num == 3)):
a = 150
else:
a = self.width - 150
if((num == 2)or(num == 4)):
b = 95
else:
b = self.height - 75
self.bars[0] = Acc_Bar(self.screen, (a,b), self.active_team.user)
def win(self, winner):
for u in self.users:
if(u == winner):
u.win()
else:
u.lose()
winner.inventory.append(u.dog_tag)
self.end()
def update(self, interact):
mouse_pos = interact[7]
click = interact[0]
self.board.update(interact)
self.active_team.update(interact, self.board)
if(self.active_team.move_made):
self.active_team.move_made = False
self.swap_teams()
for b in self.buttons:
b.update(interact)
for b in self.bars:
b.update(interact)
if(len(self.active_team.troops) == 0):
self.win(self.dormant_team.user)
elif(len(self.dormant_team.troops) == 0):
self.win(self.active_team.user)
def blitme(self):
self.board.blitme()
self.dormant_team.blitme(self.board)
for b in self.buttons:
b.blitme()
for b in self.bars:
b.blitme()
self.active_team.blitme(self.board)
示例2: Stratego
# 需要导入模块: import Board [as 别名]
# 或者: from Board import blitme [as 别名]
#.........这里部分代码省略.........
if((self.active_team.locked)and(self.dormant_team.locked)):
self.phase += 1
self.active_team.move_made = False
self.dormant_team.move_made = False
self.bars.remove(self.bars[len(self.bars)-1])
self.buttons = []
def game_phase(self):
if(self.phase == None):
events = [self.make_piece, self.set_team, self.preset]
temp = S_Piece_set(self.screen, self.size, events)
for t in temp[0]:
self.bars.append(t)
for t in temp[1]:
self.buttons.append(t)
self.phase = 0
self.doors = grande_door(self.screen, self.size, self.setit)
if(self.phase == 0):
for t in self.teamA.troops:
if(t.loc != None):
if(t.loc[1] > 3):
self.teamA.troops.remove(t)
for t in self.teamB.troops:
if(t.loc != None):
if(t.loc[1] < 6):
self.teamB.troops.remove(t)
if(self.phase == 1):
if(self.dormant_team.get_amount(11) == 0):
self.win(self.active_team.user)
elif(self.active_team.get_amount(11) == 0):
self.win(self.dormant_team.user)
elif(self.active_team.move_made):
self.active_team.move_made = False
self.doors.close()
#self.swap_teams()
def conflict(self):
for a in self.teamA.troops:
b = self.teamB.get_piece(a.loc)
if(b != None):
a.reveal()
b.reveal()
victor = None
if(a.rank > b.rank):
t_list = (b, a)
else:
t_list = (a, b)
if((t_list[0].rank == 0)and(t_list[1].rank != 3)):
victor = t_list[0]
elif(t_list[1].rank == 11):
victor = t_list[0]
elif((t_list[0].rank == 1)and(t_list[1].rank == 10)):
victor = t_list[0]
elif(t_list[0].rank != t_list[1].rank):
victor = t_list[1]
if(victor == a):
self.teamB.troops.remove(b)
elif(victor == b):
self.teamA.troops.remove(a)
else:
self.teamA.troops.remove(a)
self.teamB.troops.remove(b)
def update(self, interact):
mouse_pos = interact[7]
click = interact[0]
self.board.update(interact)
self.active_team.update(interact, self.board)
self.game_phase()
self.conflict()
for b in self.buttons:
b.update(interact)
for b in self.bars:
b.update(interact)
self.doors.update(interact)
def blitme(self):
self.board.blitme()
self.dormant_team.blitme(self.board)
self.active_team.blitme(self.board)
for b in self.buttons:
b.blitme()
for b in self.bars:
b.blitme()
if(self.active_team.dragged != None):
self.active_team.dragged.blitme(self.board, self.active_team.color)
if((self.doors.right.move)or(self.doors.is_closed())):
self.doors.blitme()
示例3: Ground_War
# 需要导入模块: import Board [as 别名]
# 或者: from Board import blitme [as 别名]
#.........这里部分代码省略.........
if(e.equip == 3):
self.active_team.equipment.remove(e)
d.equipment.remove(b)
if(e.equip == 0):
self.active_team.equipment.remove(e)
d.equipment.remove(b)
for a in self.active_team.troops:
for d in self.dormant_teams:
b = d.get_piece(a.loc)
if(b != None):
a.reveal()
b.reveal()
victor = None
if(a.rank > b.rank):
e = d.get_equip(b.loc)
if((e != None)and(e.equip == 2)):
r = b.rank + 3
if(a.rank < r):
victor = b
else:
victor = a
else:
victor = a
elif(a.rank < b.rank):
if(b.rank == 11):
victor = a
else:
victor = b
if(a.rank == 1):
if(b.rank > 4):
victor = a
if(victor == a):
d.troops.remove(b)
if(b.rank == 11):
self.capture(self.active_team, d)
elif(victor == b):
self.active_team.troops.remove(a)
else:
self.active_team.troops.remove(a)
d.troops.remove(b)
e = d.get_equip(a.loc)
if(e != None):
a.reveal()
e.reveal()
if(e.equip == 0):
self.active_team.troops.remove(a)
d.equipment.remove(e)
def win(self):
winner = self.teams[0].user
for u in self.users:
if(u == winner):
u.win()
else:
u.lose()
winner.inventory.append(u.dog_tag)
def update(self, interact):
mouse_pos = interact[7]
click = interact[0]
right_click = interact[1]
mid_click = interact[2]
for b in self.buttons:
b.update(interact)
for b in self.bars:
b.update(interact)
self.board.update(interact)
if(self.board_drag == False):
self.active_team.update(interact, self.board)
self.conflict()
self.game_phase()
self.deploy_equip()
self.move_board(right_click, mouse_pos)
self.doors.update(interact)
def blitme(self):
self.board.blitme()
for d in self.dormant_teams:
d.blitme(self.board)
self.active_team.blitme(self.board)
for b in self.buttons:
b.blitme()
for b in self.bars:
b.blitme()
if(self.active_team.dragged != None):
self.active_team.dragged.blitme(self.board, self.active_team.color)
if((self.doors.right.move)or(self.doors.is_closed())):
self.doors.blitme()