• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Understanding the Fainting Animation

  • 20
    Posts
    10
    Years
    • Seen Jun 19, 2015
    One of the things that bugs me right now is that when I defeat an enemy pokemon, they fall off the screen. I see that the fainting animation was updated in version 13 so that it shows the sprite sinking into the base (and I've seen this in Pokemon Reborn and Rejuvenation), but it doesn't seem to be working correctly for me. I think this is the relevant part from PokeBattle_Scene

    Code:
       def pbFainted(pkmn)
        frames=pbCryFrameLength(pkmn.pokemon)
        pbPlayCry(pkmn.pokemon)
        frames.times do
          pbGraphicsUpdate
          pbInputUpdate
          pbFrameUpdate(nil) 
        end
        @sprites["shadow#{pkmn.index}"].visible=false
        pkmnsprite=@sprites["pokemon#{pkmn.index}"]
        ycoord=0
        if @battle.doublebattle
          ycoord=PokeBattle_SceneConstants::PLAYERBATTLERD1_Y if pkmn.index==0
          ycoord=PokeBattle_SceneConstants::FOEBATTLERD1_Y if pkmn.index==1
          ycoord=PokeBattle_SceneConstants::PLAYERBATTLERD2_Y if pkmn.index==2
          ycoord=PokeBattle_SceneConstants::FOEBATTLERD2_Y if pkmn.index==3
        else
          if @battle.pbIsOpposing?(pkmn.index)
            ycoord=PokeBattle_SceneConstants::FOEBATTLER_Y
          else
            ycoord=PokeBattle_SceneConstants::PLAYERBATTLER_Y
          end
        end
        ycoord+=Graphics.height
        pbSEPlay("faint")
        loop do
          pkmnsprite.y+=22
          if pkmnsprite.y-pkmnsprite.oy+pkmnsprite.src_rect.height>=ycoord
            pkmnsprite.src_rect.height=ycoord-pkmnsprite.y+pkmnsprite.oy
          end
          pbGraphicsUpdate
          pbInputUpdate
          pbFrameUpdate(nil) 
          break if pkmnsprite.y>=ycoord
        end
        8.times do
          @sprites["battlebox#{pkmn.index}"].opacity-=32
          pbGraphicsUpdate
          pbInputUpdate
        end
        @sprites["battlebox#{pkmn.index}"].visible=false
        pkmn.pbResetForm
      end
    and if I'm understanding it correctly, this section

    Code:
      loop do
          pkmnsprite.y+=22
          if pkmnsprite.y-pkmnsprite.oy+pkmnsprite.src_rect.height>=ycoord
            pkmnsprite.src_rect.height=ycoord-pkmnsprite.y+pkmnsprite.oy
          end
          pbGraphicsUpdate
          pbInputUpdate
          pbFrameUpdate(nil) 
          break if pkmnsprite.y>=ycoord
    is responsible for the actual fainting animation. I think it shifts the battler's sprite's y coordinate by +22 (which apparently means down) and then checks to see if the new y coordinate would be greater than ycoord (the original y-coordinate of the bottom of the sprite). Supposedly it then "crops" the sprite (the pkmnsprite.src_rect.height part) so that the sprite appears to sink in the ground. Right now however, the sprite simply drops rapidly off the screen without being cropped, and I'm not sure why that is. Can someone tell me if my understanding of the fainting animation is correct and what I can do to try to fix it?

    EDIT: Also, for whatever reason the stopping point of the animation (ycoord?) is really high. Changing
    ycoord+=Graphics.height
    to
    ycoord+=Graphics.height-300
    causes the opposing battler sprite to stop barely above the "Fight" button, while any values lower than 300 that will simply have the sprite fall off the screen completely.
     
    Last edited:
    Back
    Top