コード例 #1
0
 def queryMenuByID(self, menu_id):
     try:
         menu_id.id
     except AttributeError:
         return callQuery(self._getEventID(menu_id, MENU_LOOKUP_KEY))
     else:
         return menu_id #is a reference
コード例 #2
0
 def lookForPlayer(self):
     pactor = self.mappe.getPlayerActor()
     x, y = map(operator.sub, pactor.getPos(), self.getPos())
     if not self.open and abs(x) + abs(y) <= OPEN_DISTANCE and callQuery(ALL_SQUID_TROPHIES_OBTAINED_QUERY):
         self.setSpriteAlpha(0.0)
         self.updateTileCollision(False)
         self.open = True
         self.setStunned(True)
         playSound(SOUND_SQUID_DOOR, True)
コード例 #3
0
 def hurtPlayer(self, x, y):
     if not self.hurt:
         self._chargeFinish()  #just in case
         self._finishSwordSwing()
         self.setHurt(90)
         self.setKnockbackVel(x, y, HURT_KNOCKBACK_VEL)
         self.hurt_control_loss = True
         playSound(SOUND_HIT_PLAYER, True)
         customEvent(PLAYER_REDUCE_HP_EVENT)
         if callQuery(CHECK_PLAYER_DEAD_QUERY):
             self.setVelocity(0, 0)
             self.Schedule(self._vanishForever, 91)
             self.Unschedule(self._endHurt)
         else:
             self.Schedule(self._regainHurtControl, HURT_CONTROL_LOSS_TIME)
コード例 #4
0
 def pushSave(self):
     savegame.setValue(SAVE_TROPHIES, copy.deepcopy(self.trophies_obtained))
     savegame.setValue(SAVE_EVENT_FLAGS, copy.deepcopy(self.game_flags))
     savegame.setValue(SAVE_PLAYER_POS, callQuery(PLAYER_GET_POS_QUERY))
     savegame.commitSave(SAVE_GAME_NAME)
コード例 #5
0
 def checkSpawn(self):
     if callQuery(SQUID_TROPHY_OBTAINED_QUERY, self.squid_trophy_index):
         self.cleanupSelf()