Project1
标题:
如何让上下键失效?但是又不影响条件设置。
[打印本页]
作者:
爆焰
时间:
2012-8-20 07:18
标题:
如何让上下键失效?但是又不影响条件设置。
如题,请高手帮帮忙 dsu_plus_rewardpost_czw
作者:
ML4455739
时间:
2012-8-20 08:08
本帖最后由 ML4455739 于 2012-8-20 08:11 编辑
全局搜索一下
def move_down(turn_enabled = true)和def move_up(turn_enabled = true)
默认的话各只有一处,如果别处还有也按照这个改试试。
Game_Character 3的13行def下面加一个if,
if !$game_switches[1]就是当1号开关打开时向下移动失效
#--------------------------------------------------------------------------
# ● 向下移动
# turn_enabled : 本场地位置更改许可标志
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
if !$game_switches[1]
# 面向下
if turn_enabled
turn_down
end
# 可以通行的场合
if passable?(@x, @y, 2) and !$game_switches[1]
# 面向下
turn_down
# 更新坐标
@y += 1
# 增加步数
increase_steps
# 不能通行的情况下
else
# 接触事件的启动判定
check_event_trigger_touch(@x, @y+1)
end
end
end
复制代码
84行左右同理,1号开关为ON时向上移动失效
#--------------------------------------------------------------------------
# ● 向上移动
# turn_enabled : 本场地位置更改许可标志
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
if !$game_switches[1]
# 面向上
if turn_enabled
turn_up
end
# 可以通行的情况下
if passable?(@x, @y, 8)
# 面向上
turn_up
# 更新坐标
@y -= 1
# 歩数増加
increase_steps
# 不能通行的情况下
else
# 接触事件的启动判定
check_event_trigger_touch(@x, @y-1)
end
end
end
复制代码
经测试这样修改不会影响按键的判定。
。。LZ是想做类似重力系统横版移动那样的?不知道是否符合您的要求。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1