本文整理匯總了Python中team.Team.is_stopped方法的典型用法代碼示例。如果您正苦於以下問題:Python Team.is_stopped方法的具體用法?Python Team.is_stopped怎麽用?Python Team.is_stopped使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類team.Team
的用法示例。
在下文中一共展示了Team.is_stopped方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ButtonSoccer
# 需要導入模塊: from team import Team [as 別名]
# 或者: from team.Team import is_stopped [as 別名]
#.........這裏部分代碼省略.........
def create_goal(self):
self.goal_red = Goal("LEFT")
self.goal_red.team_owner = self.team_red
self.goal_red.team_enemy = self.team_blue
self.goal_blue = Goal("RIGHT")
self.goal_blue.team_owner = self.team_blue
self.goal_blue.team_enemy = self.team_red
self.goals = (self.goal_red, self.goal_blue)
for goal in self.goals:
for dash in goal.elements():
self.add(dash)
def create_scores(self):
self.score_red = Score('left', 'red')
self.score_blue = Score('right', 'blue')
self.team_red.score = self.score_red
self.team_blue.score = self.score_blue
self.add(self.score_red)
self.add(self.score_blue)
def check_turn(self):
print('Turn -> ' + str(self.current_team))
if self.moves + 1 >= MOVES:
self.change_turn()
self.current_team = self.team_red if self.team_red.turn else self.team_blue
self.moves = 0
else:
self.moves += 1
def change_turn(self):
self.team_red.change_turn()
self.team_blue.change_turn()
@listen('mouse-long-press', 'left')
def update_poiter(self, pos):
self.clear_pointer()
button = None
for team in self.teams:
if team.turn:
button = team.get_clicked_button()
if button != None:
try:
size = button.pos - Vec2(pos)
p = Pointer(button.pos.as_tuple(), size.as_tuple())
self.add(p)
except ZeroDivisionError:
pass
def clear_pointer(self):
for element in self.get_render_tree().walk():
if isinstance(element, Pointer):
self.remove(element)
def movement_started(self):
self.clear_pointer()
self.movement_check = CHECK_ACTIVE
def check_goal(self, goal):
if goal.is_goal(self.ball.pos):
goal.team_enemy.points += 1
goal.team_enemy.score.submit()
self.moves = 0
self.ball.reset()
if goal.team_enemy.points >= MAX_SCORE:
self.reset()
return
if self.current_team != goal.team_owner:
self.change_turn()
def reset(self):
time.sleep(2)
self.score_red.reset()
self.score_blue.reset()
self.ball.reset()
self.team_red.reset()
self.team_blue.reset()
@listen('frame-enter')
def process(self):
# bolinha
self.ball.update_forces()
# botões
for team in self.teams:
team.update_forces()
# verificar se houve gol
self.check_goal(self.goal_red)
self.check_goal(self.goal_blue)
if self.movement_check == CHECK_ACTIVE:
if self.team_red.is_stopped() and self.team_blue.is_stopped():
self.movement_check = CHECK_IDLE
self.check_turn()