#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=: # DRG - XAS Jump Attack # Version: 1.00 # Author : LiTTleDRAgo #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=: # # Introduction : # - If you press C + direction player's facing, player will do a jump forward # and attack # - If you press C + other direction, player will step 2 tiles away to that # direction # #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=: ($imported ||= {})[:drg_xas_jump_attack] = 1.00 $xrxs_xas || raise("This script needs XAS 3.91 to work") $imported[:drg_core_engine] || raise("This script needs Drago Core Engine") #============================================================================== # ** Game_Player #------------------------------------------------------------------------------ # This class handles the player. Its functions include event starting # determinants and map scrolling. Refer to "$game_player" for the one # instance of this class. #============================================================================== class Game_Player #-------------------------------------------------------------------------- # ● Public Instance_Variables #-------------------------------------------------------------------------- attr_sec_accessor :jump_attack_range, 1 # Attack jump 1 tiles attr_sec_accessor :jump_step_range, 2 # Step jump 2 tiles #-------------------------------------------------------------------------- # ● Alias Listing #-------------------------------------------------------------------------- alias_sec_method :update_command_jump_attack, :update_command alias_sec_method :update_movement_jump_attack, :update_movement #-------------------------------------------------------------------------- # ● Update Command #-------------------------------------------------------------------------- def update_command(*args) if Input.press?(XAS_COMMAND::ATTACK_ACTION1) dir = Input.dir4 if dir == @direction unless @jump_attack == 1 @jump_attack = 1 jump_to_direction(dir, jump_attack_range) && active_attack end return elsif dir > 0 unless @jump_attack == 2 fix = @direction_fix (@jump_attack = 2) && (@direction_fix = true) jump_to_direction(dir, jump_step_range) && @direction_fix = fix end return end end @jump_attack = nil update_command_jump_attack(*args) end #-------------------------------------------------------------------------- # ● Jump to Direction #-------------------------------------------------------------------------- def jump_to_direction(dir, jump_range = 2)# Jump 2 tiles away jumping? or (p = jump_range).times do unless jumping? case dir when 6 then throw_event?(jump_range,0,p) && jump(jump_range,0) when 4 then throw_event?(-jump_range,0,p) && jump(-jump_range,0) when 2 then throw_event?(0,jump_range,p) && jump(0,jump_range) when 8 then throw_event?(0,-jump_range,p) && jump(0,-jump_range) end jump_range == 1 && jump(0,0) (jump_range -= 1) && (p -= 1) end end true end #-------------------------------------------------------------------------- # ● Movement Update #-------------------------------------------------------------------------- def update_movement update_movement_jump_attack unless Input.press?(XAS_COMMAND::ATTACK_ACTION1) end end