def _launch(self): for i in range(int(self.regulation.launchSetNum)): wait = createWait(self.regulation.setInterval) while wait(): yield for _ in range(int(self.regulation.launchRepeat(i))): pos = self.core.locator.position + Std.Vector2DF(0, 110) targetAngle = pos.getAngle( Ctrl.Actor.myShip.position) drawParam = Auxs.createBulletRedDrawParam( pos, Std.Vector2DF(24, 24*0.3)) NWay.launchLinear( pos, targetAngle, self.regulation.outerAngleInterval, self.regulation.outerWayNum, int(drawParam.dst.h), drawParam, self.regulation.outerSpeed) NWay.launchLinear( pos, targetAngle, self.regulation.innerAngleInterval, self.regulation.innerWayNum, int(drawParam.dst.h), drawParam, self.regulation.innerSpeed) launchWait = createWait(self.regulation.launchInterval) while launchWait(): yield wait = createWait(self.regulation.endWait) while wait(): yield
def _task(self): def getLaunchPos(): pos = self.position return Std.Vector2DF(pos.x, pos.y + self.SIZE.y / 3) validAreaRect = Std.Hit.RectI( 0, 0, Std.Consts.ScreenSize.x - Std.Consts.StgInfAreaSize.x, Std.Consts.ScreenSize.y, False ) while True: wait = createWait(Regulation.waitFrameNum) while wait(): yield drawParam = Auxs.createBulletRedDrawParam(getLaunchPos(), Std.Vector2DF(10, 10)) angle = self.position.getAngle(Ctrl.Actor.myShip.position) interval = Regulation.interval num = Regulation.wayNum radius = int(drawParam.dst.w / 2) for _ in range(Regulation.launchNum): pos = getLaunchPos() NWay.launchLinear(pos, angle, interval, num, radius, drawParam) launchInterval = createWait(Regulation.launchInterval) while launchInterval(): yield if not validAreaRect.isHit(self.hitRect): break
def _main(self): wait = createWait(self.regulation.firstWait) while wait():yield self.shooting = True for _ in range(int(self.regulation.launchRepeat)): pos = self._getPos() targetAngle = pos.getAngle( Ctrl.Actor.myShip.position) drawParam = Auxs.createBulletRedDrawParam( pos, Std.Vector2DF(24, 24*0.3)) NWay.launchLinear( pos, targetAngle, self.regulation.angleInterval, self.regulation.wayNum, int(drawParam.dst.h), drawParam, self.regulation.speed) launchInterval = createWait(self.regulation.launchInterval) while launchInterval(): yield self.shooting = False
def task(self, bit): rotSpeed = 15 if not self.clockwise: rotSpeed *= -1 rotSum = 0 while abs(rotSum) < 360: bit.angle += rotSpeed rotSum += rotSpeed yield bit.circling.circling = True bit.circling.circlingAngle = 15 wait = createWait(self.regulation.aimingFrameNum) rand = Ctrl.getRandom() angleError = rand.getFloat(*self.regulation.angleError) while wait(): targetAngle = bit.locator.position.getAngle(Ctrl.Actor.myShip.position) + angleError bit.circling.targetAngle = targetAngle yield bit.circling.circling = False bit.circling.circlingAngle = bit.CIRCLING_ANGLE if self.clockwise: crossLaunchAngle = bit.angle - 90 else: crossLaunchAngle = bit.angle + 90 cross = _TracingCross(self.core.resource, bit.nozzlePos, crossLaunchAngle, self.rank, self.clockwise) Ctrl.Actor.registerBullet(cross) drawParam = Auxs.createBulletRedDrawParam(bit.nozzlePos, Std.Vector2DF(16, 8)) for i in range(int(self.regulation.launchRepeat)): NWay.launchLinear( bit.nozzlePos, bit.angle, self.regulation.angleInterval, self.regulation.wayNum, int(drawParam.dst.w / 2), drawParam, self.regulation.speed(i), self.regulation.accel(i), ) wait = createWait(self.regulation.launchInterval) while wait(): yield wait = createWait(self.regulation.endWait) while wait(): yield
def launch(): for _ in range(int(self.regulation.launchRepeat)): drawParam = Auxs.createBulletRedDrawParam( bit.nozzlePos, Std.Vector2DF(16, 8)) NWay.launchLinear( bit.nozzlePos, bit.circling.angle, self.regulation.angleInterval, self.regulation.wayNum, int(drawParam.dst.w/2), drawParam, self.regulation.speed) launchWait = createWait(self.regulation.launchRepeatInterval) while launchWait(): yield
def launch(): rand = Ctrl.getRandom() while True: drawParam = Auxs.createBulletRedDrawParam( bit.nozzlePos, Std.Vector2DF(16, 8)) NWay.launchLinear( bit.nozzlePos, bit.circling.angle, self.regulation.angleInterval, self.regulation.wayNum, int(drawParam.dst.w/2), drawParam, self.regulation.speed) launchWait = createWait( rand.getFloat(*self.regulation.launchInterval)) while launchWait(): yield
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)