예제 #1
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
예제 #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
예제 #3
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
예제 #4
0
		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)
예제 #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
예제 #6
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
예제 #7
0
	def _launch(self):
		baseAngle = 0
		rotSpeed = self.regulation.launchAngleRotateSpeed
		launchNum = self.regulation.launchRepeat
		launchWaitNum = self.regulation.launchInterval
		def getPos(left):
			basePos = self.core.locator.position
			offsetX = 103
			offsetY = -40
			if left:
				return basePos + Std.Vector2DF(offsetX, offsetY)
			else:
				return basePos + Std.Vector2DF(-offsetX, offsetY)
		
		while True:
			self.shooting = True
			for _ in range(launchNum):
				angleList = NWay.getCircleAngleList(baseAngle, self.regulation.wayNum)
				for angle in angleList:
					leftCross = _LinearCross(
						self.core.resource, getPos(True), -angle, self.regulation.speed)
					Ctrl.Actor.registerBullet(leftCross)
					rightCross = _LinearCross(
						self.core.resource, getPos(False), angle, self.regulation.speed)
					Ctrl.Actor.registerBullet(rightCross)
				
				baseAngle += rotSpeed
				launchWait = createWait(launchWaitNum)
				while launchWait(): yield
			self.shooting = False
			
			interval = createWait(launchWaitNum * launchNum)
			while interval():
				baseAngle += rotSpeed
				yield
예제 #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
예제 #9
0
	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
예제 #10
0
	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
예제 #11
0
	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)
예제 #12
0
    def onDestructed(self):
        self.onErase()
        self.scoreManager.addScore(self.maxHp)

        itemNum = Regulation.itemNum
        angleList = NWay.getAngleList(Regulation.itemLaunchAngle, Regulation.itemLaunchAngleInterval, itemNum)

        def effectCallback(result):
            if not result:
                self.scoreManager.addScore(1000)

        for angle in angleList:
            item = Auxs.Item.SpAttack(self.position, angle)
            item.setEffectCallback(effectCallback)
            Ctrl.Actor.registerItem(item)
예제 #13
0
	def onDestruction(self):
		Misc.createExplosion(
			Ctrl.DrawPriority.myShip, 
			5, 
			self.locator.position, 
			self.SHIP_SIZE.getAbs() * 2, 
			1.5, 
			Std.Vector2DF(16, 16)
			)
		self.resource.se_Destruction.play()
		
		if self.power <= 2:
			itemNum = 2
		elif self.power <= 4:
			itemNum = self.power
		angleList = NWay.getAngleList(-90, 20, itemNum)
		for angle in angleList:
			item = Auxs.Item.PowerUp(self.position, angle)
			Ctrl.Actor.registerItem(item)
		
		self.power = 0
예제 #14
0
	def _main(self):
		angleList = NWay.getAngleList(
			self.regulation.bitCreationBaseAngle, 
			self.regulation.bitCreationAngleInterval, 
			self.num)
		angleList.sort(reverse = True)
		while len(self.bitPairList) < self.num:
			bit = Bit(self.core.locator.position, 
				angleList[len(self.bitPairList)], 
				self.core.resource, self.core.scoreManager, self.rank)
			Ctrl.Actor.registerEnemy(bit)
			self.core.subEnemyObjList.append(bit)
			
			def initialControl(bit):
				bit.locator.tracing = False
				bit.circling.circling = False
				bit.locator.speed.setUnitVector(bit.angle)
				bit.locator.speed *= 6
				bit.locator.accel.setUnitVector(bit.angle)
				bit.locator.accel *= -0.1
				
				while bit.locator.speed.getAbs() > 1:
					yield
				
				bit.locator.speed *= 0
				bit.locator.accel *= 0
				bit.drawPriority = Ctrl.DrawPriority.enemy4
			bitPair = [bit, Coroutine(initialControl)]
			self.bitPairList.append(bitPair)
			
			wait = createWait(self.regulation.bitCreationInterval)
			while wait(): yield
		
		def allTaskFinished():
			finished = True
			
			for bitPair in self.bitPairList:
				if bitPair[1].alive:
					finished = False
					break
			
			if self.chainGun and self.chainGun.alive:
				finished = False
			
			return finished
		
		while not allTaskFinished(): yield
		
		self._initialized = True
		
		charging = False
		firstChoice = True
		prevTaskNum = None
		while self.bitPairList:
			if len(self.bitPairList) <= self.regulation.forceChargeBitNum and not charging:
				self.chainGun = None
				for bitPair in self.bitPairList:
					charge = Charge(self.rank)
					bitPair[1] = Coroutine(charge.task)
				charging = True
			
			if allTaskFinished():
				self.chainGun = None
				for bitPair in self.bitPairList:
					bit = bitPair[0]
					bit.drawPriority = Ctrl.DrawPriority.enemy4
					bit.locator.tracing = False
					bit.locator.speed *= 0
					bit.locator.accel *= 0
					bit.circling.circling = False
				
				bitTaskList = self.regulation.bitTaskList
				if not bitTaskList:
					rand = Ctrl.getRandom()
					if firstChoice:
						taskNum = rand.getInt(0, 1)
					else:
						while True:
							taskNum = rand.getInt(0, 3)
							if taskNum != prevTaskNum:
								break
				else:
					global taskListIndex
					if taskListIndex is None or taskListIndex == len(bitTaskList):
						taskListIndex = 0
					taskNum = bitTaskList[taskListIndex]
					taskListIndex += 1
				
				if taskNum == 0:
					for i in range(len(self.bitPairList)):
						if i < self.num / 2:
							aiming = Aiming(self.core, self.rank, False)
						else:
							aiming = Aiming(self.core, self.rank, True)
						self.bitPairList[i][1] = Coroutine(aiming.task)
					self.chainGun = ChainGun(self.core, self.rank)
				elif taskNum == 1:
					for i in range(len(self.bitPairList)):
						circle = CircleForm(self.core, self.num, i, self.rank)
						self.bitPairList[i][1] = Coroutine(circle.task)
				elif taskNum == 2:
					for i in range(len(self.bitPairList)):
						if i < len(self.bitPairList) / 2:
							clockwise = False
						else:
							clockwise = True
						tracingCross = LaunchTracingCross(
							self.core, clockwise, self.rank)
						self.bitPairList[i][1] = Coroutine(tracingCross.task)
				elif taskNum == 3:
					for bitPair in self.bitPairList:
						charge = Charge(self.rank)
						bitPair[1] = Coroutine(charge.task)
					charging = True
			firstChoice = False
			prevTaskNum = taskNum
			yield