def _main(self): self.shooting = True speed = self.regulation.speed for i in range(int(self.regulation.launchSetNum)): targetAngle = self._getPos().getAngle( Ctrl.Actor.myShip.position) for _ in range(i + 1): drawParam = Auxs.createBulletBlueDrawParam( self._getPos(), Std.Vector2DF(16, 16)) NWay.launchLinear( self._getPos(), targetAngle, self.regulation.firstAngleInterval, self.regulation.firstWayNum, int(drawParam.dst.w/2), drawParam, speed) wait = createWait(self.regulation.launchInterval) while wait(): yield angleList = NWay.getAngleList( targetAngle, self.regulation.secondAngleInterval, self.regulation.secondWayNum) drawParam = Auxs.createBulletBlueDrawParam( self._getPos(), Std.Vector2DF(14, 14)) for angle in angleList: NWay.launchLinear( self._getPos(), angle, self.regulation.secondAngleIntervalPerWay, self.regulation.secondWayNumPerWay, int(drawParam.dst.w/2), drawParam, speed) wait = createWait(self.regulation.launchInterval) while wait(): yield wait = createWait(self.regulation.setInterval) while wait(): yield self.shooting = False
def _launch(self): while True: wait = createWait(self.regulation.launchWait) while wait(): yield for _ in range(int(self.regulation.launchRepeat)): pos = self.locator.position drawParam = Auxs.createBulletBlueDrawParam( pos, Std.Vector2DF(24, 8)) NWay.launchLinear( pos, self.locator.angle + 180, self.regulation.angleInterval, self.regulation.wayNum, int(drawParam.dst.w/4), drawParam, self.regulation.bulletSpeed) wait = createWait(self.regulation.launchInterval) while wait(): yield
def update(self): self.repCounter.update() rand = Ctrl.getRandom() for _ in range(self.repCounter.repeatCount): pos = self._getPos() baseAngle = 90 + rand.getFloat(-45, 45) drawParam = Auxs.createBulletBlueDrawParam( pos, Std.Vector2DF(16, 16)) drawParam.dst = pos.makeRect( drawParam.dst.w, drawParam.dst.h, True) NWay.launchLinear( pos, baseAngle, self.regulation.angleInterval, self.regulation.wayNum, int(drawParam.dst.w/4), drawParam, self.regulation.speed)
def updatePhase(self): self.locator.speed.setUnitVector(90) self.locator.speed *= 4 while self.locator.position.y < 100: yield self.locator.speed *= 0 mlActor = None while self.hp > 0: if mlActor is None or not mlActor.valid: mlActor = Auxs.Bullet.MLActor( self.resource.bml_En01_01, self.locator.position) createParam = Auxs.Bullet.MLParam() createParam.hitRadius = 2 createParam.drawParameter = Auxs.createBulletBlueDrawParam( self.locator.position, Std.Vector2DF(14, 14)) mlActor.addCreateParam(createParam) mlActor.locator.position = self.locator.position mlActor.update() yield