Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ▼ WASD Movement
- # -- Last Updated: 2014.11.29
- # -- Author: Helladen
- # -- Updated: DeadElf79
- # -- Version 1.1
- # ---- Added window selection with WASD
- #==============================================================================
- module Input
- #--------------------------------------------------------------------------
- # alias method: self.dir4
- #--------------------------------------------------------------------------
- class <<self; alias helladen_dir4 dir4; end
- def self.dir4
- return 2 if Input.press?(:Y) # S
- return 4 if Input.press?(:X) # A
- return 6 if Input.press?(:Z) # D
- return 8 if Input.press?(:R) # W
- helladen_dir4
- end
- end
- class Window_Selectable < Window_Base
- def process_cursor_move
- return unless cursor_movable?
- last_index = @index
- cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN)
- cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP)
- cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
- cursor_left (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT)
- cursor_down (Input.trigger?(:Y)) if Input.repeat?(:Y) #(:DOWN)
- cursor_up (Input.trigger?(:R)) if Input.repeat?(:R) #(:UP)
- cursor_right(Input.trigger?(:Z)) if Input.repeat?(:Z) #(:RIGHT)
- cursor_left (Input.trigger?(:X)) if Input.repeat?(:X) #(:LEFT)
- #------------------------------------------------------------------------
- # cancel per-page movement
- #------------------------------------------------------------------------
- #cursor_pagedown if !handle?(:pagedown) && Input.trigger?(:R)
- #cursor_pageup if !handle?(:pageup) && Input.trigger?(:L)
- Sound.play_cursor if @index != last_index
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment