Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # Script : Turn then Move!
- # Tác giả : Dark Sky
- # Category : Character Movement
- # Released on : April 16th 2016
- # Description : Player not only can move but also turn around when press move
- # buttons.
- #===============================================================================
- $imported ||= {}
- $imported[:dark_move_and_turn] = true
- #===============================================================================
- module DarkSky
- module MoveAndTurn
- MOVE_DELAY = 10 #Delay - No need to change this!
- end
- end
- class Game_Player
- include DarkSky::MoveAndTurn
- alias dark_move_and_turn_game_player_initialize initialize
- alias dark_move_and_turn_game_player_move_by_input move_by_input
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- dark_move_and_turn_game_player_initialize
- @move_delay = MOVE_DELAY
- end
- #--------------------------------------------------------------------------
- # * Rewrite Move By Input Method.
- #--------------------------------------------------------------------------
- def move_by_input
- return if !movable? || $game_map.interpreter.running?
- if Input.dir4 != 0
- @move_delay -= 1 if @move_delay > 0
- else
- @move_delay = MOVE_DELAY
- end
- if @move_delay > 0
- if Input.press?(:RIGHT)
- set_direction(6)
- end
- if Input.press?(:LEFT)
- set_direction(4)
- end
- if Input.press?(:UP)
- set_direction(8)
- end
- if Input.press?(:DOWN)
- set_direction(2)
- end
- else
- dark_move_and_turn_game_player_move_by_input
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment