Beispiel #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
Beispiel #2
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
Beispiel #3
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
Beispiel #4
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
Beispiel #5
0
	def updateEvent(self):
		self.resource.bgm_Stage1.play()
		
		width = Std.Consts.ScreenSize.x - Std.Consts.StgInfAreaSize.x
		height = Std.Consts.ScreenSize.y
		mikan = Mikan(self.resource, self.stageSetRef().scoreManager, 
			Std.Vector2DF(width/3, height/2), self.stageSetRef().scrollSpeed)
		Ctrl.Actor.registerEnemy(mikan)
		self.scrolledEnemyList.append(mikan)
		
		moushiwake = Moushiwake(self.resource, self.stageSetRef().scoreManager, 
			Std.Vector2DF(width/3 * 2, height/2), self.stageSetRef().scrollSpeed)
		Ctrl.Actor.registerEnemy(moushiwake)
		self.scrolledEnemyList.append(moushiwake)
		
		wait = createWait(120)
		while wait(): yield
		self.resource.bgm_Stage1.fadeOut(4)
		
		wait = createWait(60 * 4.2)
		while wait(): yield
		self.resource.se_BossAlert.play()
		self.warningAnimation.play()
		self.scoreManager.pause = True
		
		while self.appearLocator.position.y < -47: yield
		self.appearAnimation.play()
		self.resource.bgm_Boss1.play(
			#self.resource.bgm_Boss1_PlayBlocks
			)
		self.resource.bgm_Stage1.stop()
		yield
		
		wait = createWait(199 * 2)
		while wait(): yield
		
		yuno = Yuno(
			Std.Vector2DF(220, self.appearLocator.position.y + 90), 
			self.resource, self.scoreManager)
		Ctrl.Actor.registerEnemy(yuno)
		self.scoreManager.pause = False
		
		self.stageSetRef().background.startTreeCreation()
		while self.stageSetRef().scrollSpeed < 6:
			self.stageSetRef().scrollSpeed += 0.05
			yield
		else:
			self.stageSetRef().scrollSpeed = 6
		
		while yuno.hp > 0: yield
		self.resource.bgm_Boss1.stop()
		myShip = Ctrl.Actor.myShip
		myShip.setShotForbidFlag(True)
		myShip.setSpecialAttackForbidFlag(True)
		self.scoreManager.pause = True
		self.stageSetRef().createScoreRateDrawer(
			yuno.position + Std.Vector2DF(-32, 0))
		
		while yuno.valid: yield
Beispiel #6
0
						def dirConfigTask():
							message = ""
							def dirConfigDrawTask():
								color = Std.ColorF()
								dst = Std.Point2DF(120, 220)
								while True:
									font = core.resource.font_Common32
									font.setPriority(drawPriority.str)
									font.shakable = False
									font.draw(dst, color, message)
									yield
							self.drawTask = Coroutine(dirConfigDrawTask)
							
							wait = createWait(30)
							while wait(): yield
							while True:
								if Ctrl.Conf.attachControllerAxis(
									Std.Input.AxisId.XMinus):
									core.resource.se_Select2.play()
									message = ""
									break
								message = "左を入力してください"
								yield
							wait = createWait(30)
							while wait(): yield
							while True:
								if Ctrl.Conf.attachControllerAxis(
									Std.Input.AxisId.XPlus):
									core.resource.se_Select2.play()
									message = ""
									break
								message = "右を入力してください"
								yield
							wait = createWait(30)
							while wait(): yield
							while True:
								if Ctrl.Conf.attachControllerAxis(
									Std.Input.AxisId.YMinus):
									core.resource.se_Select2.play()
									message = ""
									break
								message = "上を入力してください"
								yield
							wait = createWait(30)
							while wait(): yield
							while True:
								if Ctrl.Conf.attachControllerAxis(
									Std.Input.AxisId.YPlus):
									core.resource.se_Select3.play()
									message = ""
									break
								message = "下を入力してください"
								yield
							wait = createWait(30)
							while wait(): yield
							self.drawTask = Coroutine(drawTask)
    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
Beispiel #8
0
						def dirConfigTask():
							message = ""
							def dirConfigDrawTask():
								color = Std.ColorF()
								dst = Std.Point2DF(120, 220)
								while True:
									font = Resource.getFont(
										"font32", drawPriority.str, False, 32)
									font.draw(dst, color, message)
									yield
							self.drawTask = Coroutine(dirConfigDrawTask)
							
							wait = createWait(30)
							while wait(): yield
							while True:
								if Ctrl.Conf.attachControllerAxis(
									Std.Input.AxisId.XMinus):
									message = ""
									break
								message = "左を入力してください"
								yield
							wait = createWait(30)
							while wait(): yield
							while True:
								if Ctrl.Conf.attachControllerAxis(
									Std.Input.AxisId.XPlus):
									message = ""
									break
								message = "右を入力してください"
								yield
							wait = createWait(30)
							while wait(): yield
							while True:
								if Ctrl.Conf.attachControllerAxis(
									Std.Input.AxisId.YMinus):
									message = ""
									break
								message = "上を入力してください"
								yield
							wait = createWait(30)
							while wait(): yield
							while True:
								if Ctrl.Conf.attachControllerAxis(
									Std.Input.AxisId.YPlus):
									message = ""
									break
								message = "下を入力してください"
								yield
							wait = createWait(30)
							while wait(): yield
							self.drawTask = Coroutine(drawTask)
Beispiel #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
Beispiel #10
0
    def _launchTask(self):
        core = self.option.core

        def createOptionFire(texture):
            drawParam = Std.Sprite.DrawParam()
            drawParam.texture = texture
            drawParam.src = Std.RectF(0, 0, 128, 128)
            drawParam.priority = Ctrl.DrawPriority.myShipB1
            drawParam.rotDegree = self.option.angle + 90
            self.createFire(
                Std.Vector2DF(12, 0),
                Std.Vector2DF(self.FIRE_SIZE_LIST[core.power], self.FIRE_SIZE_LIST[core.power]),
                self.option.angle,
                drawParam,
                0.5,
                angleCorrection=90,
            )

        while True:
            if not core.slow:
                self.calcRotatedLine(
                    Std.Vector2DF(),
                    self.SHOT_NUM_LIST[core.power],
                    8,
                    self.option.angle,
                    lambda pos: Shot.createNormalShot(core, pos, self.option.angle),
                )
                createOptionFire(core.resource.normalFire)

                wait = createWait(self.NORMAL_SHOT_ITV_LIST[core.power])
                while wait():
                    yield
            else:
                self.calcRotatedLine(
                    Std.Vector2DF(),
                    self.SHOT_NUM_LIST[core.power],
                    8,
                    self.option.angle,
                    lambda pos: Shot.createLockOptionShot(core, pos, self.option.angle),
                )
                createOptionFire(core.resource.lockOptionFire)

                wait = createWait(self.LOCK_SHOT_ITV_LIST[core.power])
                while wait():
                    yield
Beispiel #11
0
	def _phase1(self):
		rank = Regulation.initialRank
		self.rankCarryOver = rank - Regulation.initialRank
		
		while True:
			sideLRandom = Phase1_1.SideRandom(True, self.core, rank)
			sideRRandom = Phase1_1.SideRandom(False, self.core, rank)
			chainGun = Phase1_1.ChainGun(self.core, rank)
			wait = createWait(60 * 6)
			while wait() or chainGun.shooting:
				if self.core.sideL.valid:
					sideLRandom.update()
				if self.core.sideR.valid:
					sideRRandom.update()
				chainGun.update()
				yield
			
			regulation_Phase1_2 = Regulation.Phase1_2(rank)
			wait = createWait(regulation_Phase1_2.firstWait)
			while wait(): yield
			
			missileHolder = Phase1_2.MissileHolder(self.core, rank)
			while not missileHolder.end:
				missileHolder.update()
				yield
			
			regulation_Phase1_3 = Regulation.Phase1_3(rank)
			wait = createWait(regulation_Phase1_3.firstWait)
			while wait(): yield
			
			chainGun = Phase1_3.ChainGun(self.core, rank)
			crossCircle = Phase1_3.CrossCircle(self.core, rank)
			while not crossCircle.end or chainGun.shooting:
				chainGun.update()
				crossCircle.update()
				yield
			
			wait = createWait(90)
			while wait(): yield
			
			rank += Regulation.rankIncrement
			self.rankCarryOver = rank - Regulation.initialRank
			yield
Beispiel #12
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
Beispiel #13
0
		def myShipMoveTask():
			speed = 3
			targetPos = Std.Vector2DF(110, 400)
			distance = targetPos.getDistance(myShip.position)
			vector = Std.Vector2DF()
			vector.setUnitVector(myShip.position.getAngle(targetPos))
			vector *= speed
			
			wait = createWait(distance / speed)
			while wait():
				pos = myShip.position
				myShip.position = pos + vector
				yield
Beispiel #14
0
	def _main(self):
		repeatNum = int(self.regulation.launchNum)
		for i in range(repeatNum):
			if((self.core.sideL.valid and i % 2 == 0) or 
			(self.core.sideR.valid and i % 2 == 1)):
				pos = self._getPos(i % 2 == 0)
				missile = Missile(
					pos, self.core.resource, self.rank)
				Ctrl.Actor.registerEnemy(missile)
				self.core.subEnemyObjList.append(missile)
				
				wait = createWait(self.regulation.launchInterval)
				while wait(): yield
Beispiel #15
0
		def launch():
			while True:
				speedVector = Std.Vector2DF()
				speedVector.setUnitVector(bit.circling.angle)
				speedVector *= self.regulation.initialBulletSpeed
				accelVector = Std.Vector2DF()
				accelVector.setUnitVector(bit.circling.angle)
				accelVector *= self.regulation.bulletAccel
				bullet = TracingBullet(
					bit.backNozzlePos, speedVector, accelVector, 
					self.regulation)
				Ctrl.Actor.registerBullet(bullet)
				
				launchWait = createWait(self.regulation.launchInterval)
				while launchWait(): yield
Beispiel #16
0
			def backTask():
				speed = 12
				
				while self.charBackDrawParam.dst.x < 0:
					self.charBackDrawParam.dst.x += speed
					yield
				self.charBackDrawParam.dst.x = 0
				
				while not end: yield
				
				wait = createWait(10)
				while wait(): yield
				while self.charBackDrawParam.dst.x < 440:
					self.charBackDrawParam.dst.x += speed
					yield
Beispiel #17
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
Beispiel #18
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
Beispiel #19
0
	def _phase2(self):
		rank = Regulation.initialRank + self.rankCarryOver*Regulation.rankCarryOverRate
		
		wait = createWait(90)
		while wait(): yield
		
		while True:
			bitManager = Phase2_1.BitManager(self.core, rank)
			while not bitManager.end:
				bitManager.update()
				yield
			
			crossLauncher = Phase2_2.CrossLauncher(self.core, rank)
			chainGun = Phase2_2.ChainGun(self.core, rank)
			while crossLauncher.shooting or not chainGun.end:
				crossLauncher.update()
				chainGun.update()
				yield
			
			rank += Regulation.rankIncrement
			yield
Beispiel #20
0
			def charMoveTask(_drawParam = None, left = True):
				drawParam = _drawParam
				speed = 10
				waitSpeed = 0.1
				if not left:
					speed *= -1
					waitSpeed *= -1
				yield
				
				wait = createWait(40)
				while wait():
					drawParam.dst.x += speed
					yield
				
				while not end:
					drawParam.dst.x += waitSpeed
					yield
				
				while drawParam.dst.x > -drawParam.dst.w and drawParam.dst.x < 440:
					drawParam.dst.x += speed
					yield
Beispiel #21
0
	def _task(self):
		self.starCreationTask = Coroutine(self._starCreationTask)
		self.visibleRate = 0
		while True:
			self.visibleRate += self.rate * self.INCREASE_RATE
			if self.visibleRate >= self.rate:
				self.visibleRate = self.rate
				break
			yield
		
		wait = createWait(self.MOVE_WAIT)
		while wait() or self.starCreationTask.alive: yield
		
		self.locator.speed.setUnitVector(self.MOVE_DIR)
		self.locator.speed *= self.MOVE_SPEED
		alpha = 1.0
		while alpha > 0:
			alpha -= self.ALPHA_DECREASE
			
			self.fontAlpha = alpha
			for star in self.starList:
				star.alpha = alpha
			yield
Beispiel #22
0
		def task():
			self.drawParam.texture = Std.Sprite.loadTexture("Hidamari/Regular/GameOver.dds", False)
			self.drawParam.src = Std.RectF(0, 0, 640, 480)
			self.drawParam.dst = self.drawParam.src
			self.drawParam.priority = drawPriority.back
			
			bgm = Std.Sound.loadStream("Hidamari/Regular/GameOver.ogg")
			bgm.play()
			
			while self.blackRect.color.a > 0:
				self.blackRect.color.a -= 1 / 60
				yield
			self.blackRect.color.a = 0
			
			wait = createWait(60 * 4)
			while wait():
				if Std.Input.getController().isPush(Std.Input.KeyId.Z):
					break
				yield
			
			while self.blackRect.color.a < 1:
				self.blackRect.color.a += 1 / 60
				yield
			self.blackRect.color.a = 1
Beispiel #23
0
			def controlCross(self):
				self.core.face.strain()
				pos = self._getPos(self.right)
				angle = 0
				
				for _ in range(int(crossNum)):
					cross = CirclingCross(self.core.resource, 
						pos, circleRadius, angle, self.rank)
					Ctrl.Actor.registerBullet(cross)
					self.crossList.append(cross)
					
					angle += 360 / crossNum
					
					wait = createWait(appearWait)
					while wait(): yield
				
				for cross in self.crossList:
					cross.locator.radiusSpeed = -2
					cross.locator.radiusAccel = 0.05
				
				rSpeed = 0.35
				while(len(self.crossList) > 0 and 
					self.crossList[0].locator.radiusSpeed < rSpeed):
					yield
				
				for cross in self.crossList:
					cross.locator.radiusSpeed = rSpeed
					cross.locator.radiusAccel = 0
					cross.locator.angleSpeed = angleSpeed
					if self.right:
						cross.locator.angleSpeed *= -1
					if not self.right:
						cross.locator.centerSpeed.setUnitVector(15)
					else:
						cross.locator.centerSpeed.setUnitVector(165)
					cross.locator.centerSpeed *= 0.5
Beispiel #24
0
	def task(self, bit):
		wait = createWait(self.regulation.firstWait)
		while wait(): yield
		
		for _ in range(int(self.regulation.repeatNum)):
			if self.left:
				center = self.core.locator.position + Std.Vector2DF(
					*self.regulation.moveCenterPosOffset)
			else:
				offset = Std.Vector2DF(*self.regulation.moveCenterPosOffset)
				offset.x *= -1
				center = self.core.locator.position + offset
			
			areaSizeX = self.regulation.moveAreaSize[0] / 2
			areaSizeY = self.regulation.moveAreaSize[1] / 2
			rand = Ctrl.getRandom()
			bitPos = center + Std.Vector2DF(
				rand.getFloat(-areaSizeX, areaSizeX), 
				rand.getFloat(-areaSizeY, areaSizeY))
			bit.locator.tracing = True
			bit.locator.maxCirclingAngle = 180
			bit.locator.targetPosition = bitPos
			bit.locator.speed = Std.Vector2DF(1, 0) * 4
			bit.locator.accel *= 0
			
			wait = createWait(
				self.regulation.launchFrameNum + 
				rand.getFloat(*self.regulation.launchFrameNumVariance))
			launcher = None
			while wait():
				if bit.locator.speed.getAbs() > 0.1:
					speedAngle = bit.locator.speed.getAngle()
					accel = Std.Vector2DF()
					accel.setUnitVector(speedAngle + 180)
					accel *= 0.1
					bit.locator.accel = accel
				else:
					bit.locator.speed *= 0
					bit.locator.accel *= 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
					if launcher is None:
						launcher = Coroutine(launch)
					if launcher.alive:
						launcher.resume()
				
				if not launcher is None and launcher.alive:
					bit.circling.circling = False
				else:
					targetAngle = bit.locator.position.getAngle(
						Ctrl.Actor.myShip.position)
					bit.circling.circling = True
					bit.circling.targetAngle = targetAngle
				yield
Beispiel #25
0
	def task(self, bit):
		def getTargetPos():
			pos = Std.Vector2DF()
			pos.setUnitVector(self.angle)
			pos *= self.regulation.radius
			pos.y *= self.regulation.yScale
			pos += Std.Vector2DF(*self.regulation.offset)
			return self.core.position + pos
		def getTargetAngle():
			return self.core.position.getAngle(
				Ctrl.Actor.myShip.position)
		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
		
		bit.locator.tracing = True
		bit.locator.targetPosition = getTargetPos()
		bit.locator.maxCirclingAngle = 180
		bit.locator.speed = Std.Vector2DF(1, 0) * self.regulation.moveSpeed
		bit.circling.circling = True
		launcher = Coroutine(launch)
		yield
		
		wait = createWait(self.regulation.beginWait)
		while wait():
			self.angle += self.regulation.rotateSpeed
			bit.locator.targetPosition = getTargetPos()
			bit.circling.targetAngle = getTargetAngle()
			yield
		
		wait = createWait(self.regulation.rotateFrameNum)
		while wait():
			self.angle += self.regulation.rotateSpeed
			bit.locator.targetPosition = getTargetPos()
			bit.circling.targetAngle = getTargetAngle()
			launcher.resume()
			
			"""
			if Std.sin(self.angle) > 0:
				bit.drawPriority = Ctrl.DrawPriority.enemyB1
			else:
				bit.drawPriority = Ctrl.DrawPriority.enemy4
			"""
			yield
		
		wait = createWait(self.regulation.endWait)
		while wait():
			self.angle += self.regulation.rotateSpeed
			bit.locator.targetPosition = getTargetPos()
			bit.circling.targetAngle = getTargetAngle()
			yield
Beispiel #26
0
		def launchTask():
			core = option.core
			def getValue(value, rate = 1):
				return value + (
					value*core.relationalOptionLevel*self.OPTION_LEVEL_EFFECT_RATE*rate)
			def createOptionFire(texture, spAttack = False):
				drawParam = Std.Sprite.DrawParam()
				drawParam.texture = texture
				drawParam.src = Std.RectF(0, 0, 128, 128)
				drawParam.priority = Ctrl.DrawPriority.myShipB1
				drawParam.rotDegree = option.angle + 90
				if spAttack:
					drawParam.alphaBlend = Std.Sprite.AlphaBlend.Add
					size = Std.Vector2DF(self.SP_FIRE_SIZE, self.SP_FIRE_SIZE)
				else:
					size = Std.Vector2DF(
						self.FIRE_SIZE_LIST[core.power], self.FIRE_SIZE_LIST[core.power])
				self.createFire(
					Std.Vector2DF(), 
					size, 
					option.angle, 
					drawParam, 
					0.5, 
					angleCorrection = 90)
			
			while True:
				if not core.isSpAttacking:
					if not core.slow:
						self.calcRotatedLine(
							Std.Vector2DF(), 
							self.SHOT_NUM_LIST[core.power], 
							8, 
							option.angle, 
							lambda pos: Shot.createNormalShot(core, pos, option.angle, 
								getValue(self.NORMAL_SHOT_DAMAGE_LIST[core.power]), 
								max(getValue(self.NORMAL_PA_DAMAGE), self.NORMAL_PA_DAMAGE), 
								max(getValue(self.SHOT_HP, 2), self.SHOT_HP)))
						createOptionFire(core.resource.normalFire)
						
						interval = self.NORMAL_SHOT_ITV_LIST[core.power]
						wait = createWait(
							min(interval + core.relationalOptionLevel, interval))
						while wait(): yield
					else:
						self.calcRotatedLine(
							Std.Vector2DF(), 
							self.SHOT_NUM_LIST[core.power], 
							8, 
							option.angle, 
							lambda pos: Shot.createLockOptionShot(core, pos, option.angle, 
								getValue(self.LOCK_SHOT_DAMAGE_LIST[core.power]), 
								max(getValue(self.LOCK_PA_DAMAGE), self.LOCK_PA_DAMAGE), 
								max(getValue(self.SHOT_HP, 2), self.SHOT_HP)))
						createOptionFire(core.resource.lockOptionFire)
						
						interval = self.LOCK_SHOT_ITV_LIST[core.power]
						wait = createWait(
							min(interval + core.relationalOptionLevel, interval))
						while wait(): yield
				else:
					if not core.slow:
						self.calcRotatedLine(
							Std.Vector2DF(), 
							1, 
							8, 
							option.angle, 
							lambda pos: Shot.createSpNormalShot(core, pos, option.angle, 
								getValue(self.SP_NORMAL_DAMAGE), 
								max(getValue(self.SP_NORMAL_PA_DAMAGE), self.SP_NORMAL_PA_DAMAGE), 
								max(getValue(self.SP_NORMAL_DAMAGE_TO_BULLET), self.SP_NORMAL_DAMAGE_TO_BULLET), 
								max(getValue(self.SP_NORMAL_HP, 2), self.SP_NORMAL_HP)))
						createOptionFire(core.resource.normalFire)
						
						interval = self.SP_NORMAL_ITV
						wait = createWait(
							min(interval + core.relationalOptionLevel, interval))
						while wait(): yield
					else:
						self.calcRotatedLine(
							Std.Vector2DF(), 
							1, 
							8, 
							option.angle, 
							lambda pos: Shot.createSpLockOptionShot(core, pos, option.angle, 
								getValue(self.SP_LOCK_DAMAGE), 
								max(getValue(self.SP_LOCK_PA_DAMAGE), self.SP_LOCK_PA_DAMAGE),
								max(getValue(self.SP_LOCK_DAMAGE_TO_BULLET), self.SP_LOCK_DAMAGE_TO_BULLET),  
								max(getValue(self.SP_LOCK_HP, 2), self.SP_LOCK_HP)))
						createOptionFire(core.resource.lockOptionFire)
						
						interval = self.SP_LOCK_ITV
						wait = createWait(
							min(interval + core.relationalOptionLevel, interval))
						while wait(): yield
Beispiel #27
0
	def _launchTask(self):
		while True:
			if not self.core.slow:
				self.calcRotatedLine(
					Std.Vector2DF(20, 0), 
					self.NORMAL_SHOT_NUM_LIST[self.core.power], 
					10, 
					-90, 
					lambda pos: Shot.createNormalShot(self.core, pos, -90), 
					30)
				
				drawParam = Std.Sprite.DrawParam()
				drawParam.texture = self.core.resource.normalFire
				drawParam.src = Std.RectF(0, 0, 128, 128)
				drawParam.priority = Ctrl.DrawPriority.myShipB1
				drawParam.rotDegree = 0
				size = self.FIRE_SIZE_LIST[self.core.power]
				self.createFire(
					Std.Vector2DF(20, 0), 
					Std.Vector2DF(size, size), 
					-90, 
					drawParam, 
					0.5, 
					2, 
					20, 
					angleCorrection = 90)
				
				self.se_NormalShot.play()
				
				wait = createWait(self.NORMAL_SHOT_ITV_LIST[self.core.power])
				while wait(): yield
			else:
				pos = self.core.position + Std.Vector2DF(0, -20)
				shot = Shot.LockMainShot(self.core, pos, -90, self.lockShotToggle, 
					self.LOCK_SHOT_RADIUS_LIST[self.core.power], 
					self.LOCK_SHOT_DAMAGE_LIST[self.core.power])
				Ctrl.Actor.registerMyShot(shot)
				
				drawParam = Std.Sprite.DrawParam()
				if self.lockShotToggle:
					drawParam.texture = self.core.resource.lockMainFire_1
				else:
					drawParam.texture = self.core.resource.lockMainFire_2
				drawParam.src = Std.RectF(0, 0, 128, 128)
				drawParam.priority = Ctrl.DrawPriority.myShipB1
				drawParam.rotDegree = 0
				size = self.LOCK_FIRE_SIZE_LIST[self.core.power]
				self.createFire(
					Std.Vector2DF(20, 0), 
					Std.Vector2DF(size, size), 
					-90, 
					drawParam, 
					0.5, 
					angleCorrection = 90)
				
				self.se_LockShot.play()
				
				self.lockShotToggle = not self.lockShotToggle
				
				wait = createWait(2)
				while wait(): yield
Beispiel #28
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
Beispiel #29
0
		def launchTask():
			def getValue(value, rate = 1):
				return value + (
					value*core.relationalOptionLevel*self.OPTION_LEVEL_EFFECT_RATE*rate)
			
			while True:
				if not core.isSpAttacking:
					if not core.slow:
						self.calcRotatedLine(
							Std.Vector2DF(20, 0), 
							self.NORMAL_SHOT_NUM_LIST[core.power], 
							10, 
							-90, 
							lambda pos: Shot.createNormalShot(core, pos, -90, 
								getValue(self.NORMAL_SHOT_DAMAGE_LIST[core.power]), 
								max(getValue(self.NORMAL_PA_DAMAGE), self.NORMAL_PA_DAMAGE), 
								max(getValue(self.SHOT_HP, 2), self.SHOT_HP)), 
							30)
						
						drawParam = Std.Sprite.DrawParam()
						drawParam.texture = core.resource.normalFire
						drawParam.src = Std.RectF(0, 0, 128, 128)
						drawParam.priority = Ctrl.DrawPriority.myShipB1
						drawParam.rotDegree = 0
						size = self.FIRE_SIZE_LIST[core.power]
						self.createFire(
							Std.Vector2DF(20, 0), 
							Std.Vector2DF(size, size), 
							-90, 
							drawParam, 
							0.5, 
							2, 
							20, 
							angleCorrection = 90)
						
						core.resource.se_NormalShot.play()
						
						interval = self.NORMAL_SHOT_ITV_LIST[core.power]
						wait = createWait(
							min(interval + core.relationalOptionLevel, interval))
						while wait(): yield
					else:
						pos = core.position + Std.Vector2DF(0, -20)
						shot = Shot.LockMainShot(core, pos, -90, self.lockShotToggle, 
							self.LOCK_SHOT_RADIUS_LIST[core.power], 
							getValue(self.LOCK_SHOT_DAMAGE_LIST[core.power]))
						shot.paBaseDamage = max(
							getValue(self.LOCK_PA_DAMAGE), self.LOCK_PA_DAMAGE)
						shot.hp = max(getValue(self.SHOT_HP, 2), self.SHOT_HP)
						Ctrl.Actor.registerMyShot(shot)
						
						drawParam = Std.Sprite.DrawParam()
						if self.lockShotToggle:
							drawParam.texture = core.resource.lockMainFire_1
						else:
							drawParam.texture = core.resource.lockMainFire_2
						drawParam.src = Std.RectF(0, 0, 128, 128)
						drawParam.priority = Ctrl.DrawPriority.myShipB1
						drawParam.rotDegree = 0
						size = self.LOCK_FIRE_SIZE_LIST[core.power]
						self.createFire(
							Std.Vector2DF(20, 0), 
							Std.Vector2DF(size, size), 
							-90, 
							drawParam, 
							0.5, 
							angleCorrection = 90)
						
						core.resource.se_LockShot.play()
						
						self.lockShotToggle = not self.lockShotToggle
						
						wait = createWait(2)
						while wait(): yield
				else:
					if not core.slow:
						self.calcRotatedLine(
							Std.Vector2DF(20, 0), 
							4, 
							10, 
							-90, 
							lambda pos: Shot.createSpNormalShot(core, pos, -90, 
								getValue(self.SP_NORMAL_DAMAGE), 
								max(getValue(self.SP_NORMAL_PA_DAMAGE), self.SP_NORMAL_PA_DAMAGE), 
								max(getValue(self.SP_NORMAL_DAMAGE_TO_BULLET), self.SP_NORMAL_DAMAGE_TO_BULLET), 
								max(getValue(self.SP_NORMAL_HP, 2), self.SP_NORMAL_HP)), 
							30)
						
						drawParam = Std.Sprite.DrawParam()
						drawParam.texture = core.resource.normalFire
						drawParam.src = Std.RectF(0, 0, 128, 128)
						drawParam.priority = Ctrl.DrawPriority.myShipB1
						drawParam.rotDegree = 0
						drawParam.alphaBlend = Std.Sprite.AlphaBlend.Add
						size = self.SP_NORMAL_FIRE_SIZE
						self.createFire(
							Std.Vector2DF(20, 0), 
							Std.Vector2DF(size, size), 
							-90, 
							drawParam, 
							0.5, 
							2, 
							20, 
							angleCorrection = 90)
						
						core.resource.se_NormalShot.play()
						
						interval = self.SP_NORMAL_ITV
						wait = createWait(
							min(interval + core.relationalOptionLevel, interval))
						while wait(): yield
					else:
						pos = core.position + Std.Vector2DF(0, -20)
						shot = Shot.LockMainShot(core, pos, -90, self.lockShotToggle, 
							self.SP_LOCK_RADIUS, 
							getValue(self.SP_LOCK_DAMAGE), 
							True)
						shot.paBaseDamage = max(
							getValue(self.SP_LOCK_PA_DAMAGE), self.SP_LOCK_PA_DAMAGE)
						shot.hp = max(getValue(self.SP_LOCK_HP, 2), self.SP_LOCK_HP)
						Ctrl.Actor.registerMyShot(shot)
						
						drawParam = Std.Sprite.DrawParam()
						if self.lockShotToggle:
							drawParam.texture = core.resource.lockMainFire_1
						else:
							drawParam.texture = core.resource.lockMainFire_2
						drawParam.src = Std.RectF(0, 0, 128, 128)
						drawParam.priority = Ctrl.DrawPriority.myShipB1
						drawParam.rotDegree = 0
						drawParam.alphaBlend = Std.Sprite.AlphaBlend.Add
						size = self.SP_LOCK_FIRE_SIZE
						self.createFire(
							Std.Vector2DF(20, 0), 
							Std.Vector2DF(size, size), 
							-90, 
							drawParam, 
							0.5, 
							angleCorrection = 90)
						
						core.resource.se_LockShot.play()
						
						self.lockShotToggle = not self.lockShotToggle
						
						wait = createWait(2)
						while wait(): yield
Beispiel #30
0
	def task(self, bit):
		wait = createWait(self.regulation.moveWait)
		while wait(): yield
		
		bit.locator.tracing = True
		bit.locator.maxCirclingAngle = self.regulation.circlingAngle
		targetPos = Ctrl.Actor.myShip.position
		bit.locator.targetPosition = targetPos
		bit.locator.speed.setUnitVector(bit.angle)
		bit.locator.speed *= self.regulation.initialBitSpeed
		bit.locator.accel.setUnitVector(bit.angle)
		bit.locator.accel *= self.regulation.bitAccel
		
		class TracingBullet(BaseBullet):
			SIZE = Std.Vector2DF(18, 18)
			
			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)
			
			@property
			def position(self):
				return self.locator.position
			def applyExternalForce(self, vec):
				return self.locator.applyExternalForce(vec)
			
			def onUpdate(self):
				self.locator.update()
				self.locator.targetPosition = Ctrl.Actor.myShip.position
				
				accel = self.locator.accel.getAbs()
				self.locator.accel.setUnitVector(
					self.locator.speed.getAngle())
				self.locator.accel *= accel
				
				if(self.frameCount >= self.regulation.bulletTracingFrameNum or 
				self.position.getDistance(self.locator.targetPosition) < self.regulation.bulletTracingEndDistance):
					self.locator.tracing = False
				
				self.drawParam.dst = self.position.makeRect(
					self.SIZE, True)
			def onDraw(self):
				Std.Sprite.draw(self.drawParam)
			
			def onErase(self):
				Auxs.createFadeOut(self.drawParam)
			def onDestructed(self):
				Auxs.createParticle(self.drawParam)
			def onDamaged(self, damage):
				pass
			def onDestructedByDamage(self, damage):
				self.onErase()
		def launch():
			while True:
				speedVector = Std.Vector2DF()
				speedVector.setUnitVector(bit.circling.angle)
				speedVector *= self.regulation.initialBulletSpeed
				accelVector = Std.Vector2DF()
				accelVector.setUnitVector(bit.circling.angle)
				accelVector *= self.regulation.bulletAccel
				bullet = TracingBullet(
					bit.backNozzlePos, speedVector, accelVector, 
					self.regulation)
				Ctrl.Actor.registerBullet(bullet)
				
				launchWait = createWait(self.regulation.launchInterval)
				while launchWait(): yield
		launcher = None
		tracing = createWait(self.regulation.tracingFrameNum)
		while tracing():
			targetPos = Ctrl.Actor.myShip.position
			bit.locator.targetPosition = targetPos
			
			if bit.locator.position.getDistance(targetPos) < self.regulation.tracingEndDistance:
				break
			
			bit.locator.accel.setUnitVector(bit.locator.speed.getAngle())
			bit.locator.accel *= self.regulation.bitAccel
			bit.angle = bit.locator.speed.getAngle()
			
			if launcher is None:
				launcher = Coroutine(launch)
			if launcher.alive:
				launcher.resume()
			yield
		
		bit.locator.tracing = False
		bit.angle = bit.locator.speed.getAngle()
		while True:
			if launcher is None:
				launcher = Coroutine(launch)
			if launcher.alive:
				launcher.resume()
			yield