设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1637|回复: 4
打印 上一主题 下一主题

[已经解决] [幫人問]事件位置問題

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1122
在线时间
26 小时
注册时间
2021-2-19
帖子
30
1
发表于 2021-8-12 23:00:32 | 显示全部楼层
事件名改成preserve即可保存
  1. class << DataManager
  2.   alias yami_create_game_objects create_game_objects
  3.   alias yami_make_save_contents make_save_contents
  4.   alias yami_extract_save_contents extract_save_contents
  5.   def create_game_objects
  6.     $YAMI_PRESERVED_EVENTS = {}
  7.     yami_create_game_objects
  8.   end
  9.   def make_save_contents
  10.     contents = yami_make_save_contents
  11.     contents[:YAMI_PRESERVED_EVENTS] = $YAMI_PRESERVED_EVENTS
  12.     contents
  13.   end
  14.   def extract_save_contents(contents)
  15.     yami_extract_save_contents(contents)
  16.     $YAMI_PRESERVED_EVENTS   = contents[:YAMI_PRESERVED_EVENTS]
  17.   end  
  18. end
  19. class Game_Map
  20.   attr_reader   :map
  21. end
  22. class Scene_Map
  23.   alias yami_pre_transfer pre_transfer
  24.   alias yami_post_transfer post_transfer
  25.   def pre_transfer   
  26.     $game_map.events.each_value do |e|
  27.       if $game_map.map.events[e.id].name.include?("preserve")
  28.         $YAMI_PRESERVED_EVENTS[[$game_map.map_id,e.id]] = [e.x,e.y]
  29.       end
  30.     end
  31.     yami_pre_transfer
  32.   end
  33.   def post_transfer
  34.     $YAMI_PRESERVED_EVENTS.each_pair do |k, v|
  35.       if $game_map.map_id == k[0]
  36.         $game_map.events[k[1]].moveto(v[0], v[1])
  37.       end
  38.     end      
  39.     yami_post_transfer
  40.   end
  41. end
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-8 07:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表