行走的腳本?
2 posters
行走的腳本?
請問一下行走如果用腳本6R全鍵盤系統寫可以嗎?
因為我想改上下左右=WSAD
因為如果再加滑鼠上下左右會卡卡的
if Kboard.repeat?( $R_Key_S)
move_down
end
if Kboard.repeat?( $R_Key_A)
move_left
end
if Kboard.repeat?( $R_Key_D)
move_right
end
if Kboard.repeat?( $R_Key_W)
move_up
end
顯然是不可以的.......
對了 除了 trigger & press & repeat 還有別的嗎?
因為我想改上下左右=WSAD
因為如果再加滑鼠上下左右會卡卡的
if Kboard.repeat?( $R_Key_S)
move_down
end
if Kboard.repeat?( $R_Key_A)
move_left
end
if Kboard.repeat?( $R_Key_D)
move_right
end
if Kboard.repeat?( $R_Key_W)
move_up
end
顯然是不可以的.......
對了 除了 trigger & press & repeat 還有別的嗎?
丘- 拿著衝鋒槍瘋狂掃射的瘋子
- 文章數 : 146
注冊日期 : 2008-05-21
年齡 : 33
來自 : 台北中和
回復: 行走的腳本?
請在Main上方插入下列RGSS代碼丘 寫到:請問一下行走如果用腳本6R全鍵盤系統寫可以嗎?
因為我想改上下左右=WSAD
因為如果再加滑鼠上下左右會卡卡的
if Kboard.repeat?( $R_Key_S)
move_down
end
if Kboard.repeat?( $R_Key_A)
move_left
end
if Kboard.repeat?( $R_Key_D)
move_right
end
if Kboard.repeat?( $R_Key_W)
move_up
end
顯然是不可以的.......
對了 除了 trigger & press & repeat 還有別的嗎?
- 代碼:
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 畫面更新
#--------------------------------------------------------------------------
def update
# 本地變量記錄移動訊息
last_moving = moving?
# 移動中、事件執行中、強制移動路線中、
# 訊息視窗一個也不顯示的時候
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
move_down if Input.press?(Input::Y) # 按S向下
move_left if Input.press?(Input::X) # 按A向左
move_right if Input.press?(Input::Z) # 按D向右
move_up if Input.press?(Input::R) # 按W向上
end
# 本地變量記憶座標
last_real_x = @real_x
last_real_y = @real_y
super
# 角色向下移動、畫面上的位置在中央下方的情況下
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# 畫面向下捲動
$game_map.scroll_down(@real_y - last_real_y)
end
# 角色向左移動、畫面上的位置在中央左方的情況下
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# 畫面向左捲動
$game_map.scroll_left(last_real_x - @real_x)
end
# 角色向右移動、畫面上的位置在中央右方的情況下
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# 畫面向右捲動
$game_map.scroll_right(@real_x - last_real_x)
end
# 角色向上移動、畫面上的位置在中央上方的情況下
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# 畫面向上捲動
$game_map.scroll_up(last_real_y - @real_y)
end
# 不在移動中的情況下
unless moving?
# 上次主角移動中的情況
if last_moving
# 與同位置的事件接觸就判斷為事件啟動
result = check_event_trigger_here([1,2])
# 沒有可以啟動的事件的情況下
if result == false
# 除錯模式為 ON 並且按下 CTRL 鍵的情況下除外
unless $DEBUG and Input.press?(Input::CTRL)
# 遇敵計算數值下降
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# 按下 C 鍵的情況下
if Input.trigger?(Input::C)
# 判斷為同位置以及正面的事件啟動
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
丘- 拿著衝鋒槍瘋狂掃射的瘋子
- 文章數 : 146
注冊日期 : 2008-05-21
年齡 : 33
來自 : 台北中和
回復: 行走的腳本?
XYZR是她內建Input模組對應的代碼....因為我是用內建腳本改的懶得再去抓全鍵盤腳本丘 寫到:好像怪怪的
對話時可移動主角 BY:愚零鬥武多 相衝
我自己先修修看
請問
那~位甚麼是XYZR呢?
要查詢內建對應按鈕可以按說明檔=>內容=>RPG Maker XP=>遊戲的操作方法
兩者融合應該不難吧....
- 代碼:
#============================================================================
# ★★★★★★★★ 對話時可移動主角 BY:愚零鬥武多 ★★★★★★★★
#============================================================================
#■功能概述■
#1.可實現對話框出現時可自由移動主角的功能
#■使用說明■
#1.設定方式TALK_CAN_MOVE_SWITCH_ID = 開關編號
# 例 : TALK_CAN_MOVE_SWITCH_ID = 10
# 開關10開啟在對話時主角可以移動
# 開關10關閉在對話時主角無法移動
#
#2.以下為設定區
TALK_CAN_MOVE_SWITCH_ID = 10
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 畫面更新
#--------------------------------------------------------------------------
def update
# 本地變量記錄移動訊息
last_moving = moving?
# 開關[TALK_CAN_MOVE_SWITCH_ID]決定對話時主角是否可移動
# (on時可移動)
unless $game_switches[TALK_CAN_MOVE_SWITCH_ID]
stop_move = ($game_system.map_interpreter.running? or $game_temp.message_window_showing)
else
stop_move = false
end
# 不是移動中、不是強制移動路線中、stop_move為false
unless moving? or @move_route_forcing or stop_move
move_down if Input.press?(Input::Y) # 按S向下
move_left if Input.press?(Input::X) # 按A向左
move_right if Input.press?(Input::Z) # 按D向右
move_up if Input.press?(Input::R) # 按W向上
end
# 本地變量記憶座標
last_real_x = @real_x
last_real_y = @real_y
super
# 角色向下移動、畫面上的位置在中央下方的情況下
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# 畫面向下捲動
$game_map.scroll_down(@real_y - last_real_y)
end
# 角色向左移動、畫面上的位置在中央左方的情況下
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# 畫面向左捲動
$game_map.scroll_left(last_real_x - @real_x)
end
# 角色向右移動、畫面上的位置在中央右方的情況下
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# 畫面向右捲動
$game_map.scroll_right(@real_x - last_real_x)
end
# 角色向上移動、畫面上的位置在中央上方的情況下
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# 畫面向上捲動
$game_map.scroll_up(last_real_y - @real_y)
end
# 不在移動中的情況下
unless moving?
# 上次主角移動中的情況
if last_moving
# 與同位置的事件接觸就判斷為事件啟動
result = check_event_trigger_here([1,2])
# 沒有可以啟動的事件的情況下
if result == false
# 除錯模式為 ON 並且按下 CTRL 鍵的情況下除外
unless $DEBUG and Input.press?(Input::CTRL)
# 遇敵計算數值下降
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# 按下 C 鍵的情況下
if Input.trigger?(Input::C)
# 判斷為同位置以及正面的事件啟動
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
這個論壇的權限:
您 無法 在這個版面回復文章
|
|