Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- #===============================================================================
- Player Turn & Move (VX)
- Author : SirBilly (silentkingdom.com)
- Version : 1.0
- Date : 9 June 2013
- --------------------------------------------------------------------------------
- This Script makes your character turn and face the direction to move before
- moving in the chosen direction just like in the pokemon games.
- *Overwrites move_by_input method in Game_Player class.
- #===============================================================================
- Instructions
- --------------------------------------------------------------------------------
- To install this script, open up your script editor and copy/paste this script
- to an open slot below Materials but above Main.
- #===============================================================================
- Terms of Use
- --------------------------------------------------------------------------------
- * Free to use for both commercial and non-commercial projects.
- * Do not claim this as your own.
- * Crediting me in the game's credits would be appreciated.
- #===============================================================================
- =end
- #===============================================================================
- # * Script Configuration *
- #===============================================================================
- module SK
- module TURNANDMOVE
- #------------------------------------------------------------------------------
- # This is the delay time between the directional keys imput default is 7.
- #------------------------------------------------------------------------------
- Delay_Time = 7
- #------------------------------------------------------------------------------
- # Note: works best when kept over 5 and under 10.
- #------------------------------------------------------------------------------
- end
- end
- #===============================================================================
- # * End of Configuration *
- #===============================================================================
- class Game_Player < Game_Character
- #-------------------------------------------------------------------------------
- # Frame Update For Wait Time
- #-------------------------------------------------------------------------------
- alias sirbilly_turn_and_move_update update
- def update
- sirbilly_turn_and_move_update
- @wait_time = SK::TURNANDMOVE::Delay_Time unless @wait_time != nil
- @wait_time -= 1 unless @wait_time == 0
- end
- #-------------------------------------------------------------------------------
- # Movement via Input from Directional Buttons
- #-------------------------------------------------------------------------------
- def move_by_input
- return if !movable? || $game_map.interpreter.running?
- case Input.dir4
- when 2; if Input.trigger?(Input::DOWN)
- @wait_time = SK::TURNANDMOVE::Delay_Time
- set_direction(2)
- elsif @wait_time == 0
- move_down
- end
- when 4; if Input.trigger?(Input::LEFT)
- @wait_time = SK::TURNANDMOVE::Delay_Time
- set_direction(4)
- elsif @wait_time == 0
- move_left
- end
- when 6; if Input.trigger?(Input::RIGHT)
- @wait_time = SK::TURNANDMOVE::Delay_Time
- set_direction(6)
- elsif @wait_time == 0
- move_right
- end
- when 8; if Input.trigger?(Input::UP)
- @wait_time = SK::TURNANDMOVE::Delay_Time
- set_direction(8)
- elsif @wait_time == 0
- move_up
- end
- end
- end
- end
- #==============================================================================#
- # http://silentkingdom.com/ #
- #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement