I am creating a system to run much like double dragon and river city ransom. Most of the system animation like walking, running and jumping work, but when I try to program in a punch attack. Its tied to the Input::L button, but when I press the button only the first frame is shown.
I should also point out that I am editing a dash script to work for the punch attack.
I think I may know the problem, but I would like someone who knows about these things to give their opinion first.
I should also point out that I am editing a dash script to work for the punch attack.
Code:
#==============================================================================
# ** Game_Character (part 1)
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
attr_accessor :character_name
attr_accessor :animating
attr_accessor :frame
#--------------------------------------------------------------------------
# * Set Animation
#--------------------------------------------------------------------------
def set_animate(name)
return if @animating
@frame = 8
@old_char = @character_name
@character_name = name
@animating = true
@anim_wait = 40
@pattern = 0
@direction_fix = true
end
#--------------------------------------------------------------------------
# * End Animate
#--------------------------------------------------------------------------
def end_animate
@animating = false
@character_name = @old_char
@direction_fix = false
end
end
#==============================================================================
# ++ グラフィック変更ダッシュ ver. 1.21 ++
#  Script by パラ犬
#  http://para.j-mx.com/
#------------------------------------------------------------------------------
# 「Graphics/Charactersã€Âフォルダã«
# 「(先é Âã‚Âャラã®æ©行グラフィックåÂÂ)+_dashã€Âã¨ã„ã†åÂÂå‰Âã®ファイルãÂ΋Â‚ã‚‹å ´åˆ
# ダッシュ時ã®グラフィックã¨ã—ã¦使çâ€Â¨Ã£Â—ã¾ã™。(例:001-Fighter01_dash)
#==============================================================================
class Game_Player < Game_Character
SPEED_PUNCH = 5 # How fast to punch
#The Key to press when punching
KEY_PUNCH = Input::L
# "_dash"グラフィックãÂŒå˜在ã—ãªãÂ„å ´åˆダッシュをã™るã‹( true:ã™る / false:ã—ãªã„ )
NO_FILE_PUNCH = true
# é™æ¢時ã¯グラフィックを変更ã—ãªã„( true:変更ã—ãªã„ / false:変更ã™る )
CHANGE_IN_MOVING = false
# ダッシュç¦Âæ¢イベントスイッãƒÂID
# (イベントコマンド「スイッãƒÂã®æ“Â作ã€Âã§ã“ã®番å·ã®スイッãƒÂã‚’ONã«ã—ã¦ã„る間ã¯
# ダッシュを機能を無効ã«ã—ã¾ã™)
NO_PUNCH_SWITCH = 998
end
#==============================================================================
# â– Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
alias punch_update update
def update
# イベント実行ä¸Âã€Â移動ルート強制ä¸Âã€Â
# メッセージウィンドウ表示ä¸Âã®ã„ãšれã§もãªãÂ„å ´åˆ
unless $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
if !($game_switches[NO_PUNCH_SWITCH])
# ã‚Âー判定
if Input.press?(KEY_PUNCH) and (CHANGE_IN_MOVING == false or Input.dir8 != 0)
if (punch_graphic_exist?($game_party.actors[0]) or NO_FILE_PUNCH)
# ダッシュä¸Âã§ãªã‘れã°ダッシュ
if @move_speed != SPEED_PUNCH
@move_speed = SPEED_PUNCH
@punch_on = true
animate(@character_name)
$game_player.refresh
end
end
elsif @punch_on == nil or @punch_on
@move_speed = SPEED_NORMAL
@punch_on = nil
$game_player.refresh
end
end
end
dash_update
end
#--------------------------------------------------------------------------
# â—‹ ダッシュグラフィックã®有無をãƒÂェック
#--------------------------------------------------------------------------
def punch_graphic_exist?(actor)
# èªÂã¿込ã¿テスト
begin
RPG::Cache.character(actor.character_name.to_s + "_punch", actor.character_hue)
rescue
return false
end
return true
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
alias punch_refresh refresh
def refresh
dash_refresh
# パーティ人数ãÂÅ’ 0 人ã§ãªãÂ„å ´åˆ
if $game_party.actors.size != 0
actor = $game_party.actors[0]
# ã‚Âャラクターã®ファイルåÂÂã¨色相をè¨Â定
if @punch_on and punch_graphic_exist?(actor)
fileplus = "_punch"
else
fileplus = ""
end
@character_name = actor.character_name + fileplus
@character_hue = actor.character_hue
end
end
#--------------------------------------------------------------------------
# * Animate(object, name)
#--------------------------------------------------------------------------
def animate(name)
set_animate(name)
end
end
I think I may know the problem, but I would like someone who knows about these things to give their opinion first.