Exemplo n.º 1
0
	def update(self):
		dirX = Ctrl.getController().direction.x
		if dirX > 0 and not self.core.moveForbidFlag:
			self.rollAmount += self.ROLL_SPEED
		elif dirX < 0 and not self.core.moveForbidFlag:
			self.rollAmount -= self.ROLL_SPEED
		else:
			if self.rollAmount < 0:
				self.rollAmount += self.ROLL_SPEED
				if self.rollAmount > 0:
					self.rollAmount = 0
			elif self.rollAmount > 0:
				self.rollAmount -= self.ROLL_SPEED
				if self.rollAmount < 0:
					self.rollAmount = 0
		
		self._setDrawParam()
		
		if not self.hitMarkerAnimation.playing:
			self.hitMarkerAnimation.play()
		else:
			self.hitMarkerAnimation.update()
		updateDst(self.hitMarkerAnimation, self.core.position, self.HIT_MARKER_SIZE)
		
		if not self.backFireAnimation.playing:
			self.backFireAnimation.play()
		else:
			self.backFireAnimation.update()
		updateDst(self.backFireAnimation, self.backFirePos, self.BACK_FIRE_SIZE)
Exemplo n.º 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)
Exemplo n.º 3
0
	def update(self):
		self.baseDrawParam.dst = self.core.locator.position.makeRect(
			self.BASE_SIZE, True)
		if self.faceNumber == 0:
			self.baseDrawParam.texture = self.core.resource.st1_YunoBase
		elif self.faceNumber == 1:
			self.baseDrawParam.texture = self.core.resource.st1_YunoBase_1
		elif self.faceNumber == 2:
			self.baseDrawParam.texture = self.core.resource.st1_YunoBase_2
		elif self.faceNumber == 3:
			self.baseDrawParam.texture = self.core.resource.st1_YunoBase_3
		elif self.faceNumber == 4:
			self.baseDrawParam.texture = self.core.resource.st1_YunoBase_4
		elif self.faceNumber == 5:
			self.baseDrawParam.texture = self.core.resource.st1_YunoBase_5
		else:
			self.baseDrawParam.texture = self.core.resource.st1_YunoBase
		
		updateDst(self.rotorAnimation, self.core.locator.position, self.BASE_SIZE)
		if not self.rotorAnimation.playing:
			self.rotorAnimation.play()
		self.rotorAnimation.update()
		
		self.smokeRepCounter.update()
		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
		if self.sideL_valid:
			self.sideLDrawParam.dst = self.core.locator.position.makeRect(
				self.BASE_SIZE, True)
		elif self.core.hp > 0:
			createSmoke(True)
		if self.sideR_valid:
			self.sideRDrawParam.dst = self.core.locator.position.makeRect(
				self.BASE_SIZE, True)
		elif self.core.hp > 0:
			createSmoke(False)
Exemplo n.º 4
0
	def onUpdate(self):
		self.locator.update()
		
		inValidArea = self.isHitRect(self.VALID_AREA)
		if self.prevValidArea and not inValidArea:
			self.createBlast()
		self.prevValidArea = inValidArea
		
		if not self.animation.playing:
			self.animation.play()
		self.animation.update()
		updateDst(self.animation, self.position, self.SIZE)
Exemplo n.º 5
0
	def update(self):
		self.shipDrawParam.dst = self.ship.position.makeRect(self.ship.SHIP_SIZE, True)
		self.hitMarkDrawParam.dst = self.ship.position.makeRect(self.HIT_MARK_SIZE, True)
		self.barrierDrawParam.dst = self.ship.position.makeRect(self.BARRIER_SIZE, True)
		if self.ship.barrierCount > 20:
			self.barrierDrawParam.color = Std.ColorF()
		else:
			self.barrierDrawParam.color = Std.ColorF(1, 1, 1, 
				self.ship.barrierCount * 1/20)
		
		if self.spBeginAnimation.playing:
			self.spBeginAnimation.update()
			updateDst(self.spBeginAnimation, 
				self.ship.position, self.SPBEGIN_ANIME_SIZE)
		if self.spFinishAnimation.playing:
			self.spFinishAnimation.update()
			updateDst(self.spFinishAnimation, 
				self.ship.position, self.SPFINISH_ANIME_SIZE)
		if self.spFinishingAnimation.playing:
			self.spFinishingAnimation.update()
			updateDst(self.spFinishingAnimation, 
				self.ship.position, self.SPFINISHING_ANIME_SIZE)
		if self.spGaugeAnimation.playing:
			self.spGaugeAnimation.update()
			updateDst(self.spGaugeAnimation, 
				self.ship.position, self.SPGAUGE_ANIME_SIZE)
Exemplo n.º 6
0
	def onUpdate(self):
		self.locator.update()
		
		if self.frameCounnt <= 0:
			drawParam = self.animation.frameHolder.drawParameter
			if drawParam.color.a > 0:
				self.baseDamage = 0
				drawParam.color.a -= 0.1
				self.animation.frameHolder.drawParameter = drawParam
			else:
				self.valid = False
		else:
			self.frameCounnt -= 1
		
		if not self.animation.playing:
			self.animation.play()
		self.animation.update()
		updateDst(self.animation, self.position, self.SIZE)
Exemplo n.º 7
0
	def onUpdate(self):
		if self.appearLocator.position.y <= Std.Consts.ScreenSize.y:
			if self.appearAnimation.playing:
				self.appearAnimation.update()
			self.appearLocator.speed.y = self.stageSetRef().scrollSpeed
			self.appearLocator.update()
			updateDst(self.appearAnimation, 
				self.appearLocator.position, Std.Vector2DF(440, 332), False)
		
		if self.warningAnimation.playing:
			self.warningAnimation.update()
		
		self.scrolledEnemyList = [enemy for enemy in self.scrolledEnemyList if enemy.valid]
		for enemy in self.scrolledEnemyList:
			enemy.speed = self.stageSetRef().scrollSpeed
		
		if self.eventCoroutine.alive:
			self.eventCoroutine.resume()
		else:
			self.end = True
Exemplo n.º 8
0
	def update(self):
		if self.spBeginAnimation.playing:
			self.spBeginAnimation.update()
			updateDst(self.spBeginAnimation, self.core.position, self.SPBEGIN_SIZE)
		if self.spFinishAnimation.playing:
			self.spFinishAnimation.update()
			updateDst(self.spFinishAnimation, self.core.position, self.SPFINISH_SIZE)
		if self.spFinishingAnimation.playing:
			self.spFinishingAnimation.update()
			updateDst(self.spFinishingAnimation, self.core.position, self.SPFINISHING_SIZE)
		if self.spGaugeAnimation.playing:
			self.spGaugeAnimation.update()
			updateDst(self.spGaugeAnimation, self.core.position, self.SPGAUGE_SIZE)
Exemplo n.º 9
0
	def update(self):
		self.lockingList = [[en, dam] for en, dam in self.lockingList if en.valid]
		self.lockedList = [en for en in self.lockedList if en.valid]
		
		self.lockBeginAnimationList = [(en, an) for en, an in self.lockBeginAnimationList if an.playing]
		for en, an in self.lockBeginAnimationList:
			an.update()
			updateDst(an, en.position, self.LOCK_BEGIN_ANIMATION_SIZE)
		
		invalidEnemyIdList = []
		for en, an in self.lockMarkerAnimationDict.values():
			if not en.valid:
				invalidEnemyIdList.append(en.objectId)
			else:
				if not an.playing:
					an.play()
				an.update()
				updateDst(an, en.position, self.LOCK_MARKER_SIZE)
		for enemyId in invalidEnemyIdList:
			self.lockMarkerAnimationDict.pop(enemyId)
		
		if not self.core.slow:
			self.reset()