• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Akari, Red, Kris, May - which Pokémon protagonist is your favorite? Let us know by voting in our semifinal favorite protagonist poll!
  • 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

  • 115
    Posts
    15
    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!
     
    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!
     
    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.
     
    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