本文整理汇总了Python中myrmidon.Game.timer_ticks方法的典型用法代码示例。如果您正苦于以下问题:Python Game.timer_ticks方法的具体用法?Python Game.timer_ticks怎么用?Python Game.timer_ticks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myrmidon.Game
的用法示例。
在下文中一共展示了Game.timer_ticks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import timer_ticks [as 别名]
def execute(self, window, player_num):
self.window = window
self.player_num = player_num
self.z = -10
self.image = self.window.media.gfx['player']
self.x = Game.screen_resolution[0] / 2 + self.start_offsets[self.player_num][0]
self.y = Game.screen_resolution[1] / 2 + self.start_offsets[self.player_num][1]
self.anim_time = 0
self.alpha = 0.0
self.colour = Player.colours[self.player_num]
self.selected = False
self.do_die = False
while True:
if not self.selected:
for k,v in enumerate(self.window.input.joys[self.player_num].released_buttons):
if k == 7:
continue
if v or (player_num == 2 and Game.keyboard_key_released(K_SPACE)):
self.window.media.sfx['playerregister'].sound.play()
for frame, total in Game.timer_ticks(15):
self.alpha = Game.slerp(0.0, 0.95, frame / total)
self.anim()
yield
self.selected = True
self.window.selected_players.append(self.player_num)
else:
if self.do_die:
for frame, total in Game.timer_ticks(10):
self.alpha = Game.slerp(0.0, 0.95, frame / total)
self.anim()
yield
self.destroy()
self.anim()
yield
示例2: test_iterator_throws_stop_after_given_number_of_iterations
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import timer_ticks [as 别名]
def test_iterator_throws_stop_after_given_number_of_iterations(self):
val = Game.timer_ticks(3)
next(val)
next(val)
next(val)
with self.assertRaises(StopIteration):
next(val)
示例3: state_pulse
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import timer_ticks [as 别名]
def state_pulse(self, time):
self.time = time
self.text.text = str(time)
for frame, total in Game.timer_ticks(30):
self.text.scale = Game.lerp(1.2, 1.0, frame / total)
yield
yield self.switch_state("state_normal")
示例4: test_iterator_returns_iterations_made_and_target_iterations
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import timer_ticks [as 别名]
def test_iterator_returns_iterations_made_and_target_iterations(self):
val = Game.timer_ticks(3)
self.assertEquals((1, 3), next(val))
self.assertEquals((2, 3), next(val))
self.assertEquals((3, 3), next(val))
示例5: test_returns_iterable
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import timer_ticks [as 别名]
def test_returns_iterable(self):
val = Game.timer_ticks(3)
next(val)
示例6: state_die
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import timer_ticks [as 别名]
def state_die(self):
for frame, total in Game.timer_ticks(30):
self.text.alpha = Game.lerp(1.0, 0.0, frame / total)
yield
self.text.destroy()