Esempio n. 1
0
	def _main(self):
		def launch(pos, drawParam, num, baseSpeed):
			drawParam.dst = pos.makeRect(
				drawParam.dst.w, drawParam.dst.h, True)
			NWay.launchLinearCircle(
				pos, 
				self.angle, 
				num, 
				int(drawParam.dst.w/4), 
				drawParam, 
				baseSpeed)
		
		drawParam = Auxs.createBulletRedDrawParam(
			self.pos, Std.Vector2DF(16, 16))
		launch(self.pos, drawParam, 
			self.regulation.circleBulletNum, self.regulation.circleBulletSpeed)
		
		rand = Ctrl.getRandom()
		drawParam = Auxs.createBulletRedDrawParam(
			self.pos, Std.Vector2DF(16, 8))
		for _ in range(int(self.regulation.randomBulletLaunchFrameNum)):
			for _ in range(int(self.regulation.randomBulletLaunchNum)):
				posVariance = Std.Vector2DF(
					rand.getFloat(*self.regulation.randomBulletPosVariance), 
					rand.getFloat(*self.regulation.randomBulletPosVariance))
				pos = self.pos + posVariance
				launch(pos, drawParam, 1, self.regulation.randomBulletSpeed)
			yield
Esempio n. 2
0
	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
Esempio n. 3
0
    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
Esempio n. 4
0
	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
Esempio n. 5
0
    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
Esempio n. 6
0
			def __init__(self, pos, speed, accel, regulation):
				super().__init__(pos, self.SIZE.x / 4)
				
				self.regulation = regulation
				
				self.locator = Std.Locator.TraceF(self.regulation.bulletCirclingAngle)
				self.locator.tracing = True
				self.locator.targetPosition = Ctrl.Actor.myShip.position
				self.locator.position = pos
				self.locator.speed = speed
				self.locator.accel = accel
				
				self.drawParam = Auxs.createBulletRedDrawParam(
					pos, self.SIZE)
Esempio n. 7
0
					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
Esempio n. 8
0
		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