コード例 #1
0
 def CollisionCheck_Character(self, character):
     if self.x - self.wCollisionBox/2 < character.x + character.wCollisionBox/2 and self.x + self.wCollisionBox/2 > character.x - character.wCollisionBox/2 and \
         self.y < character.y + character.hCollisionBox and self.y + self.hCollisionBox > character.y :
         if character.stateName == 'melee':
             if self.shield > 0:
                 self.shield -= character.attack
                 self.shield = max(self.shield, 0)
                 EffectManager.CallEffect('shield', self, False)
             else:
                 self.health -= character.attack
                 self.health = max(self.health, 0)
                 str = self.name + '_hit'
                 EffectManager.CallEffect( str, self, True)
                 self.hit = True
                 if self.health <= 0 :
                     self.ChangeState(PlayerState.stateList['death'], 'death')
                     self.death = True
                     if self.name != 'Jimmy' : self.GenCoin()
         if self.stateName == 'melee':
             if character.shield > 0:
                 character.shield -= self.attack
                 character.shield = max(character.shield, 0)
                 EffectManager.CallEffect('shield', character, False)
             else:
                 character.health -= self.attack
                 character.health = max(character.health, 0)
                 str = character.name + '_hit'
                 EffectManager.CallEffect( str, character, True)
                 if character.health <= 0 :
                     character.ChangeState(PlayerState.stateList['death'], 'death')
                     character.death = True
                     if character.name != 'Jimmy' : character.GenCoin()
         return(True)
     return(False)
コード例 #2
0
ファイル: Script.py プロジェクト: SEA-group/wowp_scripts
 def onHangarLoaded(self):
     from gui.Scaleform.utils.HangarSpace import g_hangarSpace
     from gui.HangarScripts.PlaneBirthday import ConfigFactory
     if self.__isEnabled or not g_hangarSpace.space:
         return
     config = ConfigFactory.get(g_hangarSpace.space.spaceName)
     self.__model = BigWorld.Model(config.MODEL_NAME)
     if self.__model:
         EffectManager.Init()
         self.__model.scale = config.SCALE
         self.__model.actionScale = 4.0
         self.__model.visible = False
         BigWorld.addModel(self.__model, BigWorld.player().spaceID)
         self.__model.position = g_hangarSpace.space.getHangarPos(
         ) + config.TRANSLATION_VECTOR
         self.__model.visible = True
         action = self.__model.action(config.ANIMATION_NAME)
         action()
         LOG_DEBUG('onHangarLoaded hp',
                   [(hp, self.__model.node(hp))
                    for i, hp in enumerate(config.PARTICLE_HPS)])
         self.__effects = [
             EffectManager.g_instance.createNodeAttachedEffect(
                 Effects.getEffectId(config.PARTICLE_NAMES[i]),
                 self.__model.node(hp), {})
             for i, hp in enumerate(config.PARTICLE_HPS)
         ]
     else:
         LOG_ERROR("can't load model", config.MODEL_NAME)
     self.__isEnabled = True
コード例 #3
0
 def CheckAlive(self):
     if self.travel >= self.maximumRange or StageManager.BulletMapCollisionCheck(
             self, 0, 0):
         self.alive = False
         if self.name == 'boss':
             EffectManager.CallEffect('explode', self, False)
             if not Camera.effect: Camera.effect = True
             SoundManager.CallEffectSound('explosion')
コード例 #4
0
def BulletMapCollisionCheck(bullet, shiftX, shiftY):
    global StageDataList, curStage
    row = int((StageDataList[curStage]['tileHeight'] *
               StageDataList[curStage]['height'] - (bullet.y + shiftY)) /
              StageDataList[curStage]['tileHeight'])
    rightCol = int((bullet.x + (bullet.wCollisionBox / 2) + shiftX) /
                   StageDataList[curStage]['tileWidth'])
    leftCol = int((bullet.x - (bullet.wCollisionBox / 2) + shiftX) /
                  StageDataList[curStage]['tileWidth'])
    if GetMapDate(row, rightCol) != '0':
        data = int(GetMapDate(row, rightCol))
        if 1 < data and data <= 300:
            data -= bullet.hit
            print(data)
            cx, cy, w, h = GetTileData(row, rightCol)
            if data < 100:
                EffectManager.CallEffect('dangerBox_hit', None, False, True,
                                         cx, cy)
            elif data < 200:
                EffectManager.CallEffect('notGoodBox_hit', None, False, True,
                                         cx, cy)
            else:
                EffectManager.CallEffect('goodBox_hit', None, False, True, cx,
                                         cy)
            if data <= 1:
                data = 0
                EffectManager.CallEffect('box_break', None, False, True, cx,
                                         cy)
                SoundManager.CallEffectSound('debris')
            value = str('%d' % data)
            StageDataList[curStage]['data'][row][rightCol] = value
        elif 300 < data and data <= 600:
            data -= bullet.hit
            cx, cy, w, h = GetTileData(row, rightCol)
            if data < 400:
                EffectManager.CallEffect('dangerRock_hit', None, False, True,
                                         cx, cy)
            elif data < 500:
                EffectManager.CallEffect('notGoodRock_hit', None, False, True,
                                         cx, cy)
            else:
                EffectManager.CallEffect('goodRock_hit', None, False, True, cx,
                                         cy)
            if data <= 300:
                data = 0
                EffectManager.CallEffect('rock_break', None, False, True, cx,
                                         cy)
                SoundManager.CallEffectSound('debris')
            value = str('%d' % data)
            StageDataList[curStage]['data'][row][rightCol] = value
        return True
    if GetMapDate(row, leftCol) != '0': return True
    return False
コード例 #5
0
 def CollisionCheck(self, player):
     self.y -= Item.hCollisionBox / 2
     if player.CollisionCheck(self):
         if player.coin >= self.coin:
             player.coin -= self.coin
             player.bullet['Rifle']["storage"] += self.bullet
             SoundManager.CallEffectSound('buy')
             self.effect = EffectManager.CallEffect('pickup_rifle', self,
                                                    False)
             self.draw = False
     self.y += Item.hCollisionBox / 2
コード例 #6
0
 def CollisionCheck(self, player):
     self.y -= Item.hCollisionBox / 2
     if player.CollisionCheck(self):
         if player.coin >= self.coin:
             player.coin -= self.coin
             player.health = min(self.health + player.health,
                                 player.maxHealth)
             SoundManager.CallEffectSound('buy')
             self.effect = EffectManager.CallEffect('pickup_health', self,
                                                    False)
             self.draw = False
     self.y += Item.hCollisionBox / 2
コード例 #7
0
    def Update(self, frameTime):
        self.PrcessInput()
        if self.reloading and self.reloadEffect.end :
            self.reloadEffect = None
            self.reloading = False
            need = self.bullet[self.ArmsNameList[self.curArm]]['max']- self.bullet[self.ArmsNameList[self.curArm]]['reloaded']
            #print(self.bullet[self.ArmsNameList[self.curArm]]['max'], need)
            need = min(need, self.bullet[self.ArmsNameList[self.curArm]]['storage'])
            self.bullet[self.ArmsNameList[self.curArm]]['reloaded'] += need
            self.bullet[self.ArmsNameList[self.curArm]]['storage'] -= need

        Character.Update(self, frameTime)
        if self.shot and not self.reloading and not self.death and self.bullet[self.ArmsNameList[self.curArm]]['reloaded'] > 0 :
            self.ArmsList[self.ArmsNameList[self.curArm]].Shoot(self,InputManager.mouseX + Camera.x - self.x, InputManager.mouseY + Camera.y - self.y - self.hCollisionBox/2 )
            if not Camera.effect : Camera.effect = True
            if self.curArm != 'Sniper' :  SoundManager.CallEffectSound('pistol')
            else :  SoundManager.CallEffectSound('sniper')
            self.bullet[self.ArmsNameList[self.curArm]]['reloaded'] -= 1
            if self.bullet[self.ArmsNameList[self.curArm]]['reloaded'] == 0 and self.bullet[self.ArmsNameList[self.curArm]]['storage'] > 0 :
                self.reloadEffect = EffectManager.CallEffect('reloading_long', InputManager.mPos, False)
                SoundManager.CallEffectSound('reload')
                self.reloading = True

        if StageManager.curStage == 'stage2_exit':
            if self.x - Camera.x <= 200  and not self.death:
                self.ChangeState(PlayerState.stateList['death'], 'death')
                self.death = True


        self.shieldTimer += frameTime
        if self.shieldTimer > self.shieldTime :
            self.shieldTimer = 0
            if self.shield < self.maxShield :
                self.genShield = True
                EffectManager.CallEffect('shield', self, False)

        if self.genShield :
            self.shield += 1
            self.shield = min(self.shield, self.maxShield)
            if (self.shield == self.maxShield) : self.genShield = False
コード例 #8
0
 def CollisionCheck_Bullet(self, bullet):
     if not self.death:
         if self.x - self.wCollisionBox/2 < bullet.x + bullet.wCollisionBox/2 and self.x + self.wCollisionBox/2 > bullet.x - bullet.wCollisionBox/2 and \
                self.y < bullet.y + bullet.hCollisionBox/2 and self.y + self.hCollisionBox > bullet.y - bullet.hCollisionBox/2 and self.ally != bullet.ally:
             if self.shield >0:
                 self.shield -= bullet.hit
                 self.shield = max(self.shield, 0)
                 EffectManager.CallEffect('shield', self, False)
             else:
                 self.health -= bullet.hit
                 self.health = max(self.health, 0)
                 str = self.name + '_hit'
                 EffectManager.CallEffect( str, self, True)
                 self.hit = True
                 if self.health <= 0 :
                     self.ChangeState(PlayerState.stateList['death'], 'death')
                     self.death = True
                     if self.name != 'Jimmy' : self.GenCoin()
             bullet.alive = False
             if bullet.name == 'boss':
                 EffectManager.CallEffect('explode', self, False )
                 if not Camera.effect : Camera.effect = True
             return(True)
     return(False)
コード例 #9
0
 def PrcessInput(self):
     if not self.dash and not self.activeAttack :
         if (InputManager.GetKeyState(SDLK_w) == InputManager.GetKeyState(SDLK_s)) :
             self.vy = 0
         elif InputManager.GetKeyState(SDLK_w):
             self.vy = Jimmy.WALK_SPEED_PPS
         elif InputManager.GetKeyState(SDLK_s):
             self.vy = -Jimmy.WALK_SPEED_PPS
         if (InputManager.GetKeyState(SDLK_a) == InputManager.GetKeyState(SDLK_d)) :
             self.vx = 0
         elif InputManager.GetKeyState(SDLK_a):
             self.vx = -Jimmy.WALK_SPEED_PPS
         elif InputManager.GetKeyState(SDLK_d):
             self.vx = Jimmy.WALK_SPEED_PPS
         if((InputManager.GetKeyState(SDLK_LSHIFT) or InputManager.GetKeyState(SDLK_RSHIFT)) and (self.vx != 0 or self.vy != 0)):
             self.dash = True
             self.vx = self.vx * Jimmy.DASH_SPEED_PPS
             self.vy = self.vy * Jimmy.DASH_SPEED_PPS
         if (InputManager.GetKeyState(SDLK_f)) and not self.death :
             dirx = InputManager.mouseX + Camera.x - self.x
             diry = InputManager.mouseY + Camera.y - self.y - self.hCollisionBox/2
             dirx, diry = Action.Nomalization(dirx, diry)
             self.vx = dirx * Jimmy.WALK_SPEED_PPS
             self.vy = diry * Jimmy.WALK_SPEED_PPS
             self.ChangeState(PlayerState.stateList['Jimmy_melee'], 'melee')
         if (InputManager.GetKeyState(SDLK_e)) and not self.death :
             for i in StageManager.PortalList[StageManager.curStage]:
                 if i.Teleport(self): break
             if StageManager.curStage == 'shop':
                 for i in StageManager.ShopItemList:
                     i.CollisionCheck(self)
             InputManager.KeyUp(SDLK_e)
         if InputManager.GetKeyState(SDLK_r) and not self.death :
             if self.bullet[self.ArmsNameList[self.curArm]]['storage'] > 0 and self.bullet[self.ArmsNameList[self.curArm]]['reloaded'] < self.bullet[self.ArmsNameList[self.curArm]]['max']\
                     and not self.reloading:
                 self.reloadEffect = EffectManager.CallEffect('reloading', InputManager.mPos, False)
                 SoundManager.CallEffectSound('reload')
                 self.reloading = True
     if InputManager.GetKeyState(SDLK_q) :
         self.curArm = (self.curArm + 1) % 3
         InputManager.KeyUp(SDLK_q)
         SoundManager.CallEffectSound('weapon_switch')
     if InputManager.LButton : self.shot = True
     else : self.shot = False
コード例 #10
0
def ChangeStage(player, goTo):
    global curStage, StageDataList, miniMapX, happy_end, bgmList
    if goTo == 'shop':
        PortalList['shop'][0].goTo = curStage
    if curStage == 'stage2_exit' and goTo == 'stage2_exit':
        happy_end = True
        curStage = goTo
        return
    if curStage != goTo:
        Bullet.BulletList.clear()
        CoinManager.coinList.clear()
        EffectManager.EffectList.clear()
    curStage = goTo
    bgmList[curStage].repeat_play()
    player.x = StageDataList[curStage]['inTeleportX']
    player.y = StageDataList[curStage]['inTeleportY'] + 30
    Camera.SetPos(player.x, player.y)
    EffectManager.CallEffect('chStage', pos, False)
    if curStage == 'stage2_exit': miniMapX = 700
    else: miniMapX = 900
コード例 #11
0
def Update(frameTime):
    global curStage, MonsterList, PortalList, PortalState, PortalEffect, pos, fireframeTimer, fireframe
    for i in MonsterList[curStage]:
        i.Update(frameTime)
    for i in MonsterList[curStage]:
        if not i.alive:
            MonsterList[curStage].remove(i)
    if len(MonsterList[curStage]) == 0 and PortalState[curStage] == 'sleep':
        PortalState[curStage] = 'createState'
        PortalEffect = EffectManager.CallEffect('genPortal',
                                                PortalList[curStage][1], False)
    if PortalEffect != None and PortalEffect.end == True:
        PortalEffect = None
        PortalList[curStage][1].active = True
    pos.x = Camera.x + Camera.w / 2
    pos.y = Camera.y
    if curStage == 'stage2_exit':
        Camera.offsetX += 5
        Camera.Move(5, 0)
        fireframeTimer += frameTime
        if (fireframeTimer >= DrawManager.frame_Interval):
            increaseRate = int(fireframeTimer / DrawManager.frame_Interval)
            fireframe = (fireframe + increaseRate) % 15
            fireframeTimer = 0
コード例 #12
0
 def onHangarLoaded(self):
     EffectManager.Init()
コード例 #13
0
 def onHangarLoaded(self):
     EffectManager.Init()
     self.__initHangar()