本文整理汇总了Python中myrmidon.Game.lerp方法的典型用法代码示例。如果您正苦于以下问题:Python Game.lerp方法的具体用法?Python Game.lerp怎么用?Python Game.lerp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myrmidon.Game
的用法示例。
在下文中一共展示了Game.lerp方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: state_pulse
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import lerp [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")
示例2: execute
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import lerp [as 别名]
def execute(self, window):
self.window = window
self.text = Game.write_text(Game.screen_resolution[0] / 2, Game.screen_resolution[1] / 2, text = "d i a g o n e x", font = self.window.media.fnt['title_name'], alignment = ALIGN_CENTRE)
self.text.z = -10
self.text.alpha = 0.0
self.window.media.mus['title'].sound.play(loops = -1)
for frame, total in Game.timer_ticks(30):
yield
for frame, total in Game.timer_ticks(30):
self.text.alpha = Game.lerp(0.0, 1.0, frame / total)
yield
self.text2 = Game.write_text(Game.screen_resolution[0] / 2, (Game.screen_resolution[1] / 2) + 200, text = "press start", font = self.window.media.fnt['title_press_start'], alignment = ALIGN_CENTRE)
self.text2.z = -10
self.text2.alpha = 0.0
for frame, total in Game.timer_ticks(30):
self.text2.alpha = Game.slerp(0.0, 1.0, frame / total)
yield
while True:
if self.window.pressed_start():
self.window.media.sfx['pressstart'].sound.play()
break
yield
for frame, total in Game.timer_ticks(20):
self.text.alpha = Game.slerp(1.0, 0.0, frame / total)
self.text2.alpha = Game.slerp(1.0, 0.0, frame / total)
yield
self.window.change_state(Window.STATE_SELECT_PLAYERS)
self.destroy()
示例3: test_returns_correct_end_value
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import lerp [as 别名]
def test_returns_correct_end_value(self):
self.assertEquals(10.0, Game.lerp(5.0, 10.0, 1.0))
示例4: test_returns_correct_start_value
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import lerp [as 别名]
def test_returns_correct_start_value(self):
self.assertEquals(5.0, Game.lerp(5.0, 10.0, 0.0))
示例5: test_returns_correct_two_thirds_value
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import lerp [as 别名]
def test_returns_correct_two_thirds_value(self):
self.assertAlmostEquals(8.333, Game.lerp(5.0, 10.0, 1.0 / 3 * 2), 3)
示例6: test_returns_correct_one_third_value
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import lerp [as 别名]
def test_returns_correct_one_third_value(self):
self.assertAlmostEquals(6.667, Game.lerp(5.0, 10.0, 1.0 / 3), 3)
示例7: state_die
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import lerp [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()