changeset 309:14c9aca8e274

Implement Remilia's laser webs.
author Thibaut Girka <thib@sitedethib.com>
date Wed, 14 Mar 2012 11:28:15 +0100
parents 7a464291dd9d
children 81c5b0b51093
files pytouhou/game/enemy.py pytouhou/game/laser.py pytouhou/vm/eclrunner.py
diffstat 3 files changed, 45 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/enemy.py
+++ b/pytouhou/game/enemy.py
@@ -168,8 +168,9 @@ class Enemy(object):
     def new_laser(self, variant, laser_type, sprite_idx_offset, angle, speed,
                   start_offset, end_offset, max_length, width,
                   start_duration, duration, end_duration,
-                  grazing_delay, grazing_extra_duration, unknown):
-        ox, oy = self.bullet_launch_offset
+                  grazing_delay, grazing_extra_duration, unknown,
+                  offset=None):
+        ox, oy = offset or self.bullet_launch_offset
         launch_pos = self.x + ox, self.y + oy
         if variant == 86:
             angle += self.get_player_angle(self.select_player(), launch_pos)
--- a/pytouhou/game/laser.py
+++ b/pytouhou/game/laser.py
@@ -40,7 +40,7 @@ class LaserLaunchAnim(object):
         self.x = laser.base_pos[0] + offset * dx
         self.y = laser.base_pos[1] + offset * dy
 
-        scale = laser.width / 10. - (offset - laser.start_offset)
+        scale = laser.width / 10. - (offset - laser.start_offset) #TODO: check
         self.sprite.rescale = (scale, scale)
         self.sprite.changed = True
 
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -1019,6 +1019,47 @@ class ECLRunner(object):
                 self._game.time_stop = True
             else:
                 self._game.time_stop = False
+        elif function == 7: # Remilia’s laser webs
+            base_angle = self._game.prng.rand_double() * 2 * pi
+            for i in xrange(16):
+                delta = [+pi / 4., -pi / 4.][i % 2]
+                ox, oy = self._enemy.bullet_launch_offset
+                length = 32. #TODO: check
+
+                # Inner circle
+                angle = base_angle + i * pi / 8.
+                ox, oy = ox + cos(angle) * length, oy + sin(angle) * length
+                length = 112. #TODO: check
+                if arg == 0:
+                    self._enemy.new_laser(85, 1, 1, angle, 0., 0., length, length, 30.,
+                                          100, 80, 15, #TODO: check
+                                          0, 0, 0, offset=(ox, oy))
+                else:
+                    self._enemy.fire(offset=(ox, oy))
+
+                # Middle circle
+                ox, oy = ox + cos(angle) * length, oy + sin(angle) * length
+                angle += delta
+
+                if arg == 0:
+                    self._enemy.new_laser(85, 1, 1, angle, 0., 0., length, length, 30.,
+                                          100, 80, 15, #TODO: check
+                                          0, 0, 0, offset=(ox, oy))
+                else:
+                    self._enemy.fire(offset=(ox, oy))
+
+                # Outer circle
+                ox, oy = ox + cos(angle) * length, oy + sin(angle) * length
+                angle += delta
+                length = 400. #TODO: check
+
+                if arg == 0:
+                    self._enemy.new_laser(85, 1, 1, angle, 0., 0., length, length, 30.,
+                                          100, 80, 15, #TODO: check
+                                          0, 0, 0, offset=(ox, oy))
+                else:
+                    self._enemy.fire(offset=(ox, oy))
+
         elif function == 8: # Remilia’s magic
             bullet_attributes = [70, 1, 1, 1, 1, 0., 0., 0., 0.7, 0]
             n = 0