comparison pytouhou/game/enemy.py @ 329:1bb78c469f64

Fix difficulty influence on bullet launch interval, and fix instruction 77's rand usage
author Thibaut Girka <thib@sitedethib.com>
date Sun, 24 Jun 2012 17:00:07 +0200
parents 56523a16db1d
children 2350147cf043
comparison
equal deleted inserted replaced
328:56523a16db1d 329:1bb78c469f64
107 angle, flags) 107 angle, flags)
108 if not self.delay_attack: 108 if not self.delay_attack:
109 self.fire() 109 self.fire()
110 110
111 111
112 def set_bullet_launch_interval(self, value, start=0.): 112 def set_bullet_launch_interval(self, value, start=0):
113 # Apply difficulty-specific modifiers: 113 # Apply difficulty-specific modifiers:
114 value *= 1. - .4 * (self._game.difficulty - 16.) / 32. 114 #TODO: check every value possible! Look around 102h.exe@0x408720
115 115 value -= value * (self._game.difficulty - 16) // 80
116 self.bullet_launch_interval = int(value) 116
117 self.bullet_launch_timer = int(value * start) 117 self.bullet_launch_interval = value
118 self.bullet_launch_timer = start % value if value else 0
118 119
119 120
120 def fire(self, offset=None, bullet_attributes=None, launch_pos=None): 121 def fire(self, offset=None, bullet_attributes=None, launch_pos=None):
121 (type_, type_idx, sprite_idx_offset, bullets_per_shot, number_of_shots, 122 (type_, type_idx, sprite_idx_offset, bullets_per_shot, number_of_shots,
122 speed, speed2, launch_angle, angle, flags) = bullet_attributes or self.bullet_attributes 123 speed, speed2, launch_angle, angle, flags) = bullet_attributes or self.bullet_attributes