Пример #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
Пример #2
0
    def update(self):
        self.damagedEffectCount = 0
        if self.enabled:
            for drawParam in self.damagedDrawParamList:
                drawParam.dst = self.core.position.makeRect(self.SIZE, True)
                drawParam.color.a -= self.DAMAGED_EFFECT_ALPHA_FALLOFF * self._getEffectRate()
            self.damagedDrawParamList = [drawParam for drawParam in self.damagedDrawParamList if drawParam.color.a > 0]

            self.hitCircle.center = self.core.position
            if self.generated:

                def createDamagedEffect(obj):
                    angle = self.core.position.getAngle(obj.position)
                    self._createDamagedDrawParam(angle)

                damage = Auxs.affectMyShotsByPA(
                    self.hitCircle,
                    self.FORCE_TO_MYSHOT * self._getEffectRate(),
                    self.DAMAGE_TO_MYSHOT * self._getEffectRate(),
                    self.LINEAR_ATTENUATION,
                    self.QUADRATIC_ATTENUATION,
                    createDamagedEffect,
                )
                self.amount -= damage * self._getEffectRate()

                Auxs.applyExRadialForceToMyShip(
                    self.hitCircle,
                    self.FORCE_TO_MYSHIP * self._getEffectRate(),
                    self.LINEAR_ATTENUATION,
                    self.QUADRATIC_ATTENUATION,
                )
                myShip = Ctrl.Actor.myShip
                if myShip.isHit(self.hitCircle):
                    createDamagedEffect(myShip)
            else:
                damage = Auxs.getMyShotsForcibleDamageForPA(self.hitCircle)
                self.amount -= damage * self._getEffectRate()

            if self.generated and self.amount <= 0:
                self.generated = False
                self.vanishedAnimation.play()
                self.core.destructBullets()

            self.amount += self.SUPPLY
            if self.amount > self.CAPACITY:
                self.amount = self.CAPACITY

            if not self.generated and (self.amount >= self.GENERATE_THRESHOLD or self.amount >= self.CAPACITY):
                self.generated = True
                self.generatedAnimation.play()
                self.se_generate.play()

            if self.generatedAnimation.playing:
                self.generatedAnimation.update()
                updateDst(self.generatedAnimation, self.core.position, self.SIZE)
            if self.vanishedAnimation.playing:
                self.vanishedAnimation.update()
                updateDst(self.vanishedAnimation, self.core.position, self.SIZE)
Пример #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(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
Пример #5
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
Пример #6
0
	def update(self):
		if not self.disappeared:
			bulletCount = Auxs.destructBullets(self.hitCircle)
			if bulletCount > 0:
				self.destruct()
		
		if self.disappeared:
			self.disappearCount -= 1
			
			if not self.disappeared:
				if self.remainder > 0:
					self.locator.position = self.INIT_POSITION
					self.onRevival()
				else:
					self.disappearCount += 1
		elif self.barriered:
			self.barrierCount -= 1
		
		self._input()
		
		self.hitCircle.center = self.locator.position
		self.itemRetrieveHitCircle.center = self.locator.position
		self.itemHitCircle.center = self.locator.position
		if self.barriered:
			self.hitCircle.radius = self.barrierRadius
		else:
			self.hitCircle.radius = self.INIT_HIT_RADIUS
		self.itemRetrieveHitCircle.radius = self.itemRetrieveRadius
		
		self.onUpdate()
Пример #7
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
Пример #8
0
	def onUpdate(self):
		self.locator.update()
		self.drawParam.dst = self.locator.position.makeRect(self.SIZE, True)
		self.drawParam.rotDegree = self.locator.speed.getAngle()
		
		force = Std.Vector2DF()
		force.setUnitVector(self.locator.speed.getAngle())
		force *= self.FORCE_TO_BULLET
		
		self.bulletDamage = self.BASE_BULLET_DAMAGE * self.damageRate
		damageSum = Auxs.applyDamageToBullets(
			self.hitRect, self.bulletDamage)
		self.applyDamage(damageSum * 2)
		rebound = Auxs.applyExForceToBullets(
			self.hitRect, force)
		self.applyExternalForce(rebound * 60)
		
		if self.locator.speed.getAbs() < 10:
			self.erase()
Пример #9
0
    def onUpdate(self):
        self.behavior.update()
        self.move.update()
        self.face.update()
        self.primalArmor.update()

        self.hpGauge.value = self.hp
        self.hpGauge.update()

        self.drawing.sideL_valid = self.sideL.valid
        self.drawing.sideR_valid = self.sideR.valid
        self.drawing.update()

        for obj in self.subEnemyObjList:
            if not obj.valid:
                self.subEnemyObjList.remove(obj)

        if self.bulletDestructionFrameCount > 0:
            Auxs.destructBullets()
            self.bulletDestructionFrameCount -= 1
Пример #10
0
	def updateDestruction(self):
		Auxs.eraseBullets()
		
		frameCount = 0
		explosionInterval = Std.RepeatCounter(3)
		random = Ctrl.getRandom()
		
		self.locator.accel.setUnitVector(90)
		self.locator.accel *= 0.08
		
		while frameCount < 60:
			explosionInterval.update()
			for _ in range(explosionInterval.repeatCount):
				offset = Std.Vector2DF(
					random.getFloat(-self.SIZE.x/2, self.SIZE.x/2), 
					random.getFloat(-self.SIZE.y/2, self.SIZE.y/2))
				Auxs.createExplosion(
					self.locator.position + offset, 
					self.EXPLOSION_SIZE / 2.0)
			
			frameCount += 1
			yield
		else:
			Std.Sprite.setShake(20, 0.3)
			Auxs.createExplosion(
				self.position, self.EXPLOSION_SIZE, 2)
			self.valid = False
Пример #11
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
Пример #12
0
	def onUpdate(self):
		super().onUpdate()
		self.mainLauncher.update()
		self.optionManager.update()
		self.lockManager.update()
		self.drawManager.update()
		
		if self.isSpAttacking:
			self.spFrameCount -= 1
			if not self.isSpAttacking:
				self._spFinished()
			elif self.spFrameCount == 60:
				self.drawManager.spFinishing()
		
		if self.spFinishedForceFrameCount > 0:
			circle = Std.Hit.CircleI(self.position, 400)
			Auxs.applyExRadialForceToBullets(circle, 0.3)
			self.spFinishedForceFrameCount -= 1
			if self.spFinishedForceFrameCount == 0:
				self.spBulletDestructionFrameCount = self.SP_BULLET_DESTRUCTION_FRAME_NUM
		if self.spBulletDestructionFrameCount > 0:
			Auxs.destructBullets()
			self.spBulletDestructionFrameCount -= 1
Пример #13
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)
Пример #14
0
	def onDestruction(self):
		Auxs.createExplosion(
			self.position, self.EXPLOSION_SIZE)
		
		itemNum = 0
		if self.powerCount <= 2:
			itemNum = 2
		elif self.powerCount <= self.MAX_POWER:
			itemNum = self.powerCount
		else:
			assert False, "invalid power count"
		for i in range(itemNum):
			angle = -180/(itemNum + 1) * (i + 1)
			item = Auxs.Item.PowerUp(self.position, angle)
			Ctrl.Actor.registerItem(item)
		
		self.powerCount = 0
		self.shipLauncher.power = self.powerCount
		self.optionManager.power = self.powerCount
		self.spFrameCount = 0
		self.shipLauncher.spShot = False
		self.optionManager.spShot = False
		self.drawing.spGaugeAnimation.stop()
Пример #15
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
Пример #16
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
Пример #17
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
Пример #18
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)
Пример #19
0
	def createExplosion(self, drawPri, num, pos, size, 
					frameItv = 1, 
					posVariance = Std.Vector2DF(), 
					sizeVarianceRate = 0, 
					frameItvVarianceRate = 0):
		rand = Ctrl.getRandom()
		expObjList = []
		for _ in range(num):
			sizeRate = rand.getFloat(
				-sizeVarianceRate, 
				sizeVarianceRate)
			correctedSize = size + size*sizeRate
			itv = rand.getFloat(
				frameItv - frameItv*frameItvVarianceRate, 
				frameItv + frameItv*frameItvVarianceRate)
			
			expObjList.append(Auxs.createExplosion2(
				self.getVariantVector(pos, posVariance), 
				Std.Vector2DF(correctedSize, correctedSize), 
				itv, 
				drawPri))
		return expObjList
Пример #20
0
	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
Пример #21
0
		def createSmoke(left):
			rand = Ctrl.getRandom()
			for _ in range(self.smokeRepCounter.repeatCount):
				pos = self.getVariantVector(
					self.core.locator.position, 
					Std.Vector2DF(6, 24))
				if left:
					pos.x += 150 - 76/2
				else:
					pos.x -= 150 - 76/2
				pos.y += 40
				
				baseSize = Std.Vector2DF(48, 48)
				sizeRate = rand.getFloat(-0.5, 0.5)
				correctedSize = baseSize + baseSize*sizeRate
				
				smoke = Auxs.createSmoke(
					pos, 
					correctedSize, 
					1, 
					Ctrl.DrawPriority.enemy2, 
					0.2)
				smoke.locator.speed.y = 2
Пример #22
0
	def applySpFinishedForce(self):
		circle = Std.Hit.CircleI(self.position, 400)
		Auxs.applyExRadialForceToBullets(circle, 0.3)
Пример #23
0
	def applyDamageToEnemy(self):
		if self.baseDamage > 0:
			Auxs.applyDamageToEnemies(self.hitRect, self.damage)
			Auxs.applyDamageToBullets(self.hitCircle, self.damage)
Пример #24
0
			def onDestructed(self):
				Auxs.createParticle(self.drawParam)
Пример #25
0
			def onErase(self):
				Auxs.createFadeOut(self.drawParam)
Пример #26
0
	def applyDamageToEnemy(self):
		Auxs.destructBullets(self.hitCircle)
		damageSum = Auxs.applyDamageToEnemies(self.hitRect, self.damage)
		if damageSum != 0:
			self.createBlast()
Пример #27
0
	def onErase(self):
		Auxs.createFadeOut(self.animation.frameHolder.drawParameter)
Пример #28
0
	def onDestructedByDamage(self, damage):
		Auxs.createFadeOut(self.drawParam)
Пример #29
0
	def applyDamageToEnemy(self):
		enemy = Auxs.applyDamageAndGetEnemy(self.hitRect, self.damage)
		if not enemy is None:
			self.core.lockManager.addLock(enemy, self.lockValue * self.damageRate)
			self.destruct()
			self.se_ShotHit.play()
Пример #30
0
	def applyDamageToEnemy(self):
		damageSum = Auxs.applyDamageToEnemies(self.hitRect, self.damage)
		if damageSum != 0:
			self.destruct()