Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Reload this Page [Question] Diving and Surfing Sprites - 4 frames instead of 2

Notices
For all updates, view the main page.

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.



Reply
 
Thread Tools
  #1    
Old December 15th, 2013 (10:42 PM).
Giu's Avatar
Giu Giu is offline
 
Join Date: Jan 2010
Gender: Male
Nature: Modest
Posts: 112
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!
Reply With Quote
  #2    
Old December 16th, 2013 (03:29 AM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
Moderator
 
Join Date: Jan 2008
Location: England
Posts: 4,067
What do the surfing sprites do in water? They bob. Have a search for that word.
__________________
Reply With Quote
  #3    
Old December 17th, 2013 (10:59 AM).
Giu's Avatar
Giu Giu is offline
 
Join Date: Jan 2010
Gender: Male
Nature: Modest
Posts: 112
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!
Reply With Quote
  #4    
Old December 17th, 2013 (11:24 AM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
Moderator
 
Join Date: Jan 2008
Location: England
Posts: 4,067
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.
__________________
Reply With Quote
  #5    
Old December 18th, 2013 (03:11 PM).
Giu's Avatar
Giu Giu is offline
 
Join Date: Jan 2010
Gender: Male
Nature: Modest
Posts: 112
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.
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are UTC -8. The time now is 03:47 AM.