本帖最后由 RPGzh500223 于 2021-7-22 21:56 编辑
一行……
- class Game_Map; def ini_event_xy; @events.each{|k, v|v.moveto(@map.events[k].x, @map.events[k].y)}; end; end
复制代码
数据存在地图里 比如1号地图数据就在“Data/Map001.rxdata”
既然有赞就完善一下方法(支持单个事件位置的初始化)
class Game_Map def ini_event_xy(id = -1, *ids) if id == -1 @events.each{|k, v|v.moveto(@map.events[k].x, @map.events[k].y)} return end (ids << id).each do |i| next if (_event = @events[i]) == nil _event.moveto(@map.events[i].x, @map.events[i].y) end end end
class Game_Map
def ini_event_xy(id = -1, *ids)
if id == -1
@events.each{|k, v|v.moveto(@map.events[k].x, @map.events[k].y)}
return
end
(ids << id).each do |i|
next if (_event = @events[i]) == nil
_event.moveto(@map.events[i].x, @map.events[i].y)
end
end
end
|