本文整理汇总了Python中myrmidon.Game.slerp方法的典型用法代码示例。如果您正苦于以下问题:Python Game.slerp方法的具体用法?Python Game.slerp怎么用?Python Game.slerp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myrmidon.Game
的用法示例。
在下文中一共展示了Game.slerp方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import slerp [as 别名]
def execute(self, window):
self.window = window
self.shown_score = False
self.press_start_text = None
self.objs = []
for frame, total in Game.timer_ticks(20):
yield
for x in range(Window.max_players):
self.objs.append(ScoreBoardPlayer(self.window, x))
for frame, total in Game.timer_ticks(50):
yield
while True:
if self.shown_score:
if self.press_start_text is None:
self.press_start_text = Game.write_text((Game.screen_resolution[0] / 2), Game.screen_resolution[1] - 100, font = self.window.media.fnt['score_press_start'], text = "- press start -", alignment = ALIGN_CENTRE)
for frame, total in Game.timer_ticks(30):
self.press_start_text.alpha = Game.slerp(0.0, 1.0, frame / total)
yield
for joy in self.window.input.joys:
if joy.released_buttons[7]:
self.window.media.sfx['pressstart'].sound.play()
for frame, total in Game.timer_ticks(20):
self.press_start_text.alpha = Game.slerp(1.0, 0.0, frame / total)
yield
for frame, total in Game.timer_ticks(10):
for x in self.objs:
x.alpha = Game.slerp(x.alpha_to, 0.0, frame / total)
yield
self.destroy()
self.window.change_state(Window.STATE_TITLE)
yield
示例2: test_doesnt_return_linear_value_for_two_thirds
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import slerp [as 别名]
def test_doesnt_return_linear_value_for_two_thirds(self):
self.assertNotAlmostEquals(8.333, Game.slerp(5.0, 10.0, 1.0 / 3 * 2), 3)
示例3: test_doesnt_return_linear_value_for_one_third
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import slerp [as 别名]
def test_doesnt_return_linear_value_for_one_third(self):
self.assertNotAlmostEquals(6.667, Game.slerp(5.0, 10.0, 1.0 / 3), 3)
示例4: test_returns_correct_mid_value
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import slerp [as 别名]
def test_returns_correct_mid_value(self):
self.assertEquals(7.5, Game.slerp(5.0, 10.0, 0.5))
示例5: test_returns_correct_end_value
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import slerp [as 别名]
def test_returns_correct_end_value(self):
self.assertEquals(10.0, Game.slerp(5.0, 10.0, 1.0))
示例6: test_returns_correct_start_value
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import slerp [as 别名]
def test_returns_correct_start_value(self):
self.assertEquals(5.0, Game.slerp(5.0, 10.0, 0.0))