本文整理汇总了Python中myrmidon.Game.angle_between_points方法的典型用法代码示例。如果您正苦于以下问题:Python Game.angle_between_points方法的具体用法?Python Game.angle_between_points怎么用?Python Game.angle_between_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myrmidon.Game
的用法示例。
在下文中一共展示了Game.angle_between_points方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def execute(self, window, player_num, rotation):
self.window = window
self.player_num = player_num
self.rotation = rotation
self.x, self.y = self.parent.x, self.parent.y
self.z = -2
self.colour = self.parent.colour
self.blend = True
self.image = self.window.media.gfx['shot']
while True:
self.move_forward(18.0)
self.grid_pos = self.window.screen_to_grid_pos(self.x, self.y)
t = self.window.grid.get_tile(*self.grid_pos)
if t is None:
self.alpha -= .2
if self.alpha < 0.0:
self.destroy()
else:
p = self.collide_with_player()
if not p is None:
angle_between = Game.angle_between_points((self.x, self.y), (p.x, p.y))
p.bump(Vector2d(dir = math.radians(float(angle_between)), mag = 10.0))
self.window.do_cam_shake(10)
p.hit_by_shot()
self.window.particle_emitters['shot_' + str(p.player_num)].add_point((self.x, self.y), death_timer = 5)
while self.scale > 0:
self.scale -= .2
yield
self.destroy()
self.move_forward(10.0)
yield
示例2: handle_player_collision
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def handle_player_collision(self):
p = self.collide_with_player(box_size = 64)
if not p is None:
angle_between = Game.angle_between_points((self.x, self.y), (p.x, p.y))
self.window.do_cam_shake(5)
p.bump(Vector2d(dir = math.radians(float(angle_between)), mag = 15.0))
self.bump(Vector2d(dir = math.radians(float(angle_between)), mag = -15.0))
random.choice(self.window.media.sfx['hurt']).sound.play()
self.window.media.sfx['bounce'].sound.play()
示例3: test_returns_correct_value_when_second_directly_above_first
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def test_returns_correct_value_when_second_directly_above_first(self):
self.assertEquals(270, Game.angle_between_points((1, 2), (1, -2)))
示例4: test_returns_correct_value_when_second_directly_to_the_left_of_first
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def test_returns_correct_value_when_second_directly_to_the_left_of_first(self):
self.assertEquals(180, Game.angle_between_points((1, 2), (-2, 2)))
示例5: test_returns_zero_for_identical_points
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def test_returns_zero_for_identical_points(self):
self.assertEquals(0, Game.angle_between_points((1, 2), (1, 2)))
示例6: test_returns_correct_value_for_quadrant_4
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def test_returns_correct_value_for_quadrant_4(self):
self.assertAlmostEquals(278.13, Game.angle_between_points((1, 2), (2, -5)), 3)
示例7: test_returns_correct_value_for_quadrant_2
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def test_returns_correct_value_for_quadrant_2(self):
self.assertAlmostEquals(135.000, Game.angle_between_points((1, 2), (-2, 5)), 3)
示例8: test_returns_correct_value_for_quadrant_1
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def test_returns_correct_value_for_quadrant_1(self):
self.assertAlmostEquals(71.565, Game.angle_between_points((1, 2), (2, 5)), 3)
示例9: test_returns_correct_value_when_second_directly_below_first
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def test_returns_correct_value_when_second_directly_below_first(self):
self.assertEqual(90, Game.angle_between_points((1, 2), (1, 4)))
示例10: test_returns_correct_value_for_quadrant_3
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import angle_between_points [as 别名]
def test_returns_correct_value_for_quadrant_3(self):
self.assertAlmostEqual(246.801, Game.angle_between_points((1, 2), (-2, -5)), 3)