范例下载
Project1.rar
(186.81 KB, 下载次数: 29)
需要以下脚本支持
class Game_Player < Game_Character #-------------------------------------------------------------------------- # ● 正面事件的启动判定 #-------------------------------------------------------------------------- def event_npc(triggers) result = false # 计算正面坐标 new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) # 全部事件的循环 for event in $game_map.events.values # 事件坐标与目标一致的情况下 if event.x == new_x and event.y == new_y and triggers.include?(event.trigger) # 跳跃中以外的情况下、启动判定是正面的事件 if not event.jumping? and not event.over_trigger? if event.instance_variable_get(:@event).name.include?("NPC") result = event end end end end return result end end
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 正面事件的启动判定
#--------------------------------------------------------------------------
def event_npc(triggers)
result = false
# 计算正面坐标
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# 全部事件的循环
for event in $game_map.events.values
# 事件坐标与目标一致的情况下
if event.x == new_x and event.y == new_y and
triggers.include?(event.trigger)
# 跳跃中以外的情况下、启动判定是正面的事件
if not event.jumping? and not event.over_trigger?
if event.instance_variable_get(:@event).name.include?("NPC")
result = event
end
end
end
end
return result
end
end
|