本文整理汇总了Python中myrmidon.Game.move_forward方法的典型用法代码示例。如果您正苦于以下问题:Python Game.move_forward方法的具体用法?Python Game.move_forward怎么用?Python Game.move_forward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myrmidon.Game
的用法示例。
在下文中一共展示了Game.move_forward方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: produce_particles
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import move_forward [as 别名]
def produce_particles(self):
if not self.particle_system._executing:
return
remove = []
for p in self.points:
p.life += 1
if not p.death_timer == None and p.life == p.death_timer:
remove.append(p)
continue
if p.stop_producing_particles:
continue
if not p.wait_rate == None:
if p.wait < p.wait_rate:
p.wait += 1
continue
p.wait = 0
for i in range(self.rate if p.rate == None else p.rate):
angle = random.randrange(p.angle_from, p.angle_to)
pos = p.pos
if self.shift_pos > 0:
pos = Game.move_forward(pos, random.randrange(0, self.shift_pos), angle)
self.particles.add(Particle(pos, 0.0, angle, 0))
for p in remove:
self.points.remove(p)
示例2: update_and_draw_particles
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import move_forward [as 别名]
def update_and_draw_particles(self):
glPushMatrix()
glEnable(GL_POINT_SPRITE)
glTexEnvf(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE)
glEnable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, self.texture.surface)
Game.engine['gfx'].last_image = self.texture.surface
glBlendFunc(GL_SRC_ALPHA, GL_ONE)
glPointSize(self.texture.width * self.size)
glBegin(GL_POINTS)
to_remove = []
for x in self.particles:
if self.particle_system._executing:
x.pos = Game.move_forward(x.pos, self.speed, x.angle)
if self.spin_speed:
x.angle += self.spin_speed
if x.alpha > 0.0:
glColor4f(self.colour[0],self.colour[1],self.colour[2],x.alpha)
glVertex2f(x.pos[0], x.pos[1])
if self.particle_system._executing:
if x.mode == 0:
x.alpha += self.fade_in_speed
if x.alpha >= 0.5:
x.mode = 1
else:
x.alpha -= self.fade_out_speed
if x.alpha <= 0.0:
to_remove.append(x)
for x in to_remove:
self.particles.remove(x)
glEnd()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glDisable(GL_POINT_SPRITE)
glPopMatrix()
示例3: test_returns_correct_value_for_non_normalised_angle
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import move_forward [as 别名]
def test_returns_correct_value_for_non_normalised_angle(self):
result = Game.move_forward((4, 5), 10.0, 380)
self.assertAlmostEquals(13.397, result[0], 3)
self.assertAlmostEquals(8.420, result[1], 3)
示例4: test_returns_correct_value_for_negative_distance
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import move_forward [as 别名]
def test_returns_correct_value_for_negative_distance(self):
result = Game.move_forward((4, 5), -10.0, 20)
self.assertAlmostEquals(-5.397, result[0], 3)
self.assertAlmostEquals(1.580, result[1], 3)
示例5: test_returns_correct_value_for_zero_distance
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import move_forward [as 别名]
def test_returns_correct_value_for_zero_distance(self):
result = Game.move_forward((4, 5), 0, 20)
self.assertEquals((4, 5), tuple(result))
示例6: test_returns_correct_value_for_quadrant_4
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import move_forward [as 别名]
def test_returns_correct_value_for_quadrant_4(self):
result = Game.move_forward((4, 5), 10.0, 20 - 90)
self.assertAlmostEquals(7.420, result[0], 3)
self.assertAlmostEquals(-4.397, result[1], 3)
示例7: test_returns_correct_value_for_quadrant_3
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import move_forward [as 别名]
def test_returns_correct_value_for_quadrant_3(self):
result = Game.move_forward((4, 5), 10.0, 20 + 180)
self.assertAlmostEquals(-5.397, result[0], 3)
self.assertAlmostEquals(1.580, result[1], 3)