Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # TheoAllen - Double Tap Dash
- # Version : 1.1
- # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
- # (English Language)
- # =============================================================================
- ($imported ||= {})[:Theo_DoubleTapDash] = true
- # =============================================================================
- # Change Logs:
- # -----------------------------------------------------------------------------
- # 2013.08.15 - Add option to keep shift as dash trigger
- # 2013.08.13 - Finished script
- # =============================================================================
- =begin
- Introduction :
- This script allow you to activate running by double tap instead of shift
- if you want to use shift for another function. However, you still could
- keep the shift dash function
- How to use :
- Put this script below material but above main
- Edit the configuration if necessary
- Terms of use :
- Credit me, TheoAllen. You are free to edit this script by your own. As long
- as you don't claim it yours. For commercial purpose, don't forget to give me
- a free copy of the game.
- =end
- # =============================================================================
- # A few configurations
- # =============================================================================
- DashDelay_Duration = 60
- # Set the maximum delay for double tap dash (entering 60 means 1 second)
- KeepShift = true
- # Set to true if you still want to enable shift-dash
- # =============================================================================
- # End of configurations. Editing below this line is your risk
- # =============================================================================
- class Game_Player < Game_Character
- alias theo_double_tap_init initialize
- def initialize
- theo_double_tap_init
- init_tap_dash_member
- end
- def init_tap_dash_member
- @pending_dash = 0
- @pending_dash2 = 0
- @dash_delay = 0
- end
- alias theo_double_tap_update update
- def update
- theo_double_tap_update
- update_tap_dash
- end
- def update_tap_dash
- if !dash?
- @dash_delay = [@dash_delay - 1,0].max
- end
- if (Input.dir4 == 0 && tap_dash?) || @dash_delay == 0
- init_tap_dash_member
- end
- if input_arrow? && !dash_impossible? && !dash?
- if @pending_dash == Input.dir4
- @pending_dash2 = Input.dir4
- else
- @pending_dash = Input.dir4
- @dash_delay = DashDelay_Duration
- end
- end
- end
- def dash_impossible?
- return @move_route_forcing || $game_map.disable_dash? || vehicle
- end
- def input_arrow?
- [:UP,:DOWN,:LEFT,:RIGHT].any? {|key| Input.trigger?(key)}
- end
- def dash?
- return false if @move_route_forcing
- return false if $game_map.disable_dash?
- return false if vehicle
- return true if KeepShift ? Input.press?(:A) : false
- return (Input.dir4 != 0 && tap_dash?)
- end
- def tap_dash?
- (@pending_dash2 == @pending_dash) && @pending_dash2 != 0
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment