Esempio n. 1
0
 def chooseState(self):
     if self.dead == True:
         self.AttackState = AttackState.gdeadState()
     elif self.damageCounter != 0:
         self.AttackState = AttackState.gRunDamageState()
     else:
         self.AttackState = AttackState.gRunState()
Esempio n. 2
0
 def chooseState(self):
     if self.dead == True:
         self.AttackState = AttackState.deadState()
     elif self.damageCounter != 0: #some type of taking damage
         if self.grounded == 0: #jump damage
             #self.actionState = 8
             self.AttackState = AttackState.JumpDamageState()
         elif self.rightkey == 0 and self.leftkey == 0: #x velocity is 0 and grounded --> stationary damage
             #self.actionState = 6
             self.AttackState = AttackState.StillDamageState()
         else: #moving damage
             #self.actionState = 7
             self.AttackState = AttackState.RunDamageState()
     elif self.isAttacking == 1: #some type of attacking and not taking damage
         if self.grounded == 0: #jump attack
             #self.actionState = 4
             self.AttackState = AttackState.JumpAttackState()
         elif self.rightkey == 0 and self.leftkey ==0: #x velocity is 0 and grounded --> stationary attack
             #self.actionState = 3
             self.AttackState = AttackState.StillAttackState()
         else: #run attack
             #self.actionState = 5
             self.AttackState = AttackState.RunAttackState()
     else: #not taking damage or attacking
         if self.grounded == 0: #jump
             #self.actionState = 2
             self.AttackState = AttackState.JumpState()
         elif self.leftkey == 0 and self.rightkey==0: #still
             #self.actionState = 0
             self.AttackState = AttackState.StillState()
         else: #running
             #self.actionState = 1
             self.AttackState = AttackState.RunState()
Esempio n. 3
0
 def chooseState(self):
     if self.inSparkle == 1:
         self.AttackState = AttackState.SparkledState()
         return
     if self.health < 499 and self.transCounter == -1:
         self.transCounter = 0
         if self.direction == 'right':
             self.image = self.transFRAMES[0]
         else:
             self.image = self.transFRAMES[2]
         self.rect = self.image.get_rect()
         self.rect.topleft = (int(self.p[0]), int(self.p[1]))
         self.AttackState = AttackState.WolfTransState()
         self.howlSound.play()
         return
     if self.transCounter >= 0 and self.transCounter < 5:
         self.AttackState = AttackState.WolfTransState()
         self.runspeed = 200
         self.isWolf = 1
         self.jumping = False
         return
     attackRand = R.randint(0,100)
     #print attackRand
     if attackRand == 5 and self.isAttacking == 0 and self.attackReady == True:
         self.isAttacking = 1
         #print "Attack"
     if self.dead == True:
         self.AttackState = AttackState.deadState()
     elif self.damageCounter != 0: #some type of taking damage
         #self.wolfHitSound.play()
         if self.grounded == 0: #jump damage
             #self.actionState = 8
             self.AttackState = AttackState.JumpDamageState()
         elif self.rightkey == 0 and self.leftkey == 0: #x velocity is 0 and grounded --> stationary damage
             #self.actionState = 6
             self.AttackState = AttackState.StillDamageState()
         else: #moving damage
             #self.actionState = 7
             self.AttackState = AttackState.RunDamageState()
     elif self.isAttacking == 1 and self.attackReady == True: #some type of attacking and not taking damage
         self.attackReady = False
         #if self.isWolf == 0:
         self.whichAttack = R.randint(0,1)
         #print whichAttack
         if self.whichAttack == 1 and self.isWolf == 0 and (Globals.State.level == '3' or Globals.State.level == '4'):
              #self.runspeed = 200
             self.jumping = False
             self.hitGroundSound.play()
             self.AttackState = AttackState.SmashAttackState()
         elif self.jumping == False and self.isWolf == 0:
             #print "shockwave"
         #self.runspeed = 100
             self.hitGroundSound.play()
             self.AttackState = AttackState.ShockwaveAttackState()
         elif self.jumping == False and self.isWolf == 1 and self.whichAttack == 1:
             #print "Nug"
             self.wolfSlashSound.play()
             self.AttackState = AttackState.SlashAttackState()
         elif self.jumping == False and self.isWolf == 1 and (Globals.State.level == '4'):
             #print "Nug"
             self.AttackState = AttackState.FireAttackState()
     elif self.isAttacking == 0: #not taking damage or attacking
         if self.grounded == 0: #jump
             #self.actionState = 2
             self.AttackState = AttackState.JumpState()
         elif self.leftkey == 0 and self.rightkey==0: #still
             #self.actionState = 0
             self.AttackState = AttackState.StillState()
         else: #running
             #self.actionState = 1
             if self.isWolf == 1:
                self.OLDFRAMES = self.FRAMES
                self.FRAMES = self.wolfFRAMES
             self.AttackState = AttackState.RunState()