Advertisement
Rafael_Sol_Maker

RSM's BETTER MOVE SPEED ACE(ALPHA)

Mar 9th, 2017
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.49 KB | None | 0 0
  1. #===============================================================================
  2. #              RAFAEL_SOL_MAKER's BETTER MOVE SPEED ACE(ALPHA)
  3. #_______________________________________________________________________________
  4. #   Description  | Uses a custom formula for moving speed and dash.
  5. #                | Still far from ready, and wasn't thoughtfully tested.
  6. #                | Use at your own risk!
  7. #________________|______________________________________________________________
  8. #===============================================================================
  9. class Game_Player < Game_Character
  10.  
  11.   # Some useful configurations
  12.   DEFAULT_MOVE_SPEED = 4
  13.   DASH_INCREMENT = 4
  14.   SPEED_FACTOR = 0.0185
  15.  
  16.   #--------------------------------------------------------------------------
  17.   # * OVERWRITE: In order to avoid overkill
  18.   #--------------------------------------------------------------------------
  19.   def real_move_speed
  20.     @move_speed + (dash? ? DASH_INCREMENT : 0)
  21.   end
  22.  
  23.   #--------------------------------------------------------------------------
  24.   # * OVERWRITE: Will provide us the real numbers.
  25.   #--------------------------------------------------------------------------
  26.   def distance_per_frame
  27.     dist = real_move_speed.to_f * SPEED_FACTOR
  28.     dist += (@move_speed > 3) ? (0.025 * (@move_speed.to_f - 3)) : 0.0
  29.   end
  30.  
  31.   #--------------------------------------------------------------------------
  32.   # * OVERWRITE: Fix the animations for us
  33.   #--------------------------------------------------------------------------
  34.   def update_anime_count
  35.     if @step_anime||(moving? && @walk_anime)
  36.       if @locked_animations.include?(@direction)
  37.         @anime_count = 0
  38.         @pattern = @original_pattern
  39.         return
  40.       end
  41.       if (@walk_anime && @locked_stopped_anims.include?(@direction))
  42.         @anime_count = 0
  43.         @pattern = @original_pattern
  44.         return
  45.       end      
  46.       @anime_count += dash? ? 1.5 : 1
  47.     else
  48.       @pattern = @original_pattern
  49.       @anime_count = 0
  50.     end
  51.   end
  52.    
  53.   #--------------------------------------------------------------------------
  54.   # * OVERWRITE: Fix the animations for us
  55.   #--------------------------------------------------------------------------
  56.   def update_animation
  57.     update_anime_count
  58.     move_speed = @move_speed
  59.     move_speed += dash? ? 1 : 0
  60.     if @anime_count > 18 - move_speed  * 2
  61.       update_anime_pattern
  62.       @anime_count = 0
  63.     end
  64.   end  
  65.  
  66. end
  67. # That's all, folks!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement