• 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.

Diving and Surfing Sprites - 4 frames instead of 2

129
Posts
14
Years
    • Seen Sep 4, 2023
    Hi everyone,

    I have been searching the scripts for the code that defines that the surfing and the diving character sprites will only use 2 frames. I want to change it to use the entire row (4 frames) instead.
    Does anyone knows where can I find it? Any subtlety I should notice related to the auto-update of the graphics?

    Thank you very much!
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    What do the surfing sprites do in water? They bob. Have a search for that word.
     
    129
    Posts
    14
    Years
    • Seen Sep 4, 2023
    Well I did find it in Sprite_Character, I played around with the script, but I didn't really understand it.

    Code:
            bob=((Graphics.frame_count%60)<30) ? 0 : 1
            self.oy=(bob>0) ? @ch-16-2 : @ch-16
    Changing the (Graphics.frame_count%60)<30 obviously changed the speed in which the animation changes.
    Changing the ? 0 : 1 changed which parts of the sprite are used (like 0 : 3 oscilates between frame 0 and frame 3.
    However, I don't know how to modify it, so to change from 0 to 1, then from one to 2 and so on.
    I know it should be something simple, like a slight modification in the 0 : 1 part, but my attempts failed.
    Any help on that would be really appreciated.
    Thank you!
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Code:
    bob=((Graphics.frame_count%60)<30) ? 0 : 1
    This line gives you two possible values for bob: 0 or 1. The value of bob is used to decide which frame of the charset is used. You want bob to have 4 possible values (0-3), sequentially and evenly-spaced.

    Code:
    bob=((Graphics.frame_count%60)/15).floor
    That's a possibility. You'll then need to make sure that the lines that use bob make sense, given how bob now works (i.e. it has 4 possible values rather than 2). The self.oy= line will need to be tweaked in some way.
     
    129
    Posts
    14
    Years
    • Seen Sep 4, 2023
    Thank you very much!
    In case anyone wants to do the same, follow Maruno's tip and change the self.oy line to
    Code:
            case bob
            when 0 
              self.oy=@ch-16-2
            when 1 
              self.oy=@ch-16
            when 2
              self.oy=@ch-16-2
            when 3
              self.oy=@ch-16
            else
              self.oy=@ch-16-2
            end

    Maybe there's an easier way, but that one works.
     
    Back
    Top