当前位置: 首页>>代码示例>>Python>>正文


Python Game.angle_between_points方法代码示例

本文整理汇总了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
开发者ID:Fiona,项目名称:Diagonex,代码行数:33,代码来源:__main__.py

示例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()
开发者ID:Fiona,项目名称:Diagonex,代码行数:11,代码来源:__main__.py

示例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)))
开发者ID:jvlomax,项目名称:Myrmidon,代码行数:4,代码来源:test_Game.py

示例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)))
开发者ID:jvlomax,项目名称:Myrmidon,代码行数:4,代码来源:test_Game.py

示例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)))
开发者ID:jvlomax,项目名称:Myrmidon,代码行数:4,代码来源:test_Game.py

示例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)
开发者ID:jvlomax,项目名称:Myrmidon,代码行数:4,代码来源:test_Game.py

示例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)
开发者ID:jvlomax,项目名称:Myrmidon,代码行数:4,代码来源:test_Game.py

示例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)
开发者ID:jvlomax,项目名称:Myrmidon,代码行数:4,代码来源:test_Game.py

示例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)))
开发者ID:chozabu,项目名称:Myrmidon,代码行数:4,代码来源:test_Game.py

示例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)
开发者ID:chozabu,项目名称:Myrmidon,代码行数:4,代码来源:test_Game.py


注:本文中的myrmidon.Game.angle_between_points方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。