Project1

标题: 显示图片时怎么不让主角移动 [打印本页]

作者: qq1138614929    时间: 2012-4-27 22:05
标题: 显示图片时怎么不让主角移动
本帖最后由 qq1138614929 于 2012-4-27 22:08 编辑

我做个用图片当游戏菜单的事件但是按方向键主角移动呀怎么解决dsu_plus_rewardpost_czw

Project7.rar

225.32 KB, 下载次数: 79


作者: end55rpg    时间: 2012-4-27 22:25
改那个game_player的update的case dir.4下面
四个方向移动的,在这里加个开关判断算了
作者: Luciffer    时间: 2012-4-27 22:26
本来我也想这么搞来着。。。我看看。。。


‘‘──Luciffer于2012-4-27 22:30补充以下内容

看懂了。。。答案是——请巧妙利用自动执行~
’’
作者: gaoheyang    时间: 2012-4-28 08:35
事件开始条件里点自动执行
作者: qq1138614929    时间: 2012-4-28 13:54
end55rpg 发表于 2012-4-27 22:25
改那个game_player的update的case dir.4下面
四个方向移动的,在这里加个开关判断算了 ...

能来个图片吗
我不会脚本
谢谢
作者: end55rpg    时间: 2012-4-29 08:41
qq1138614929 发表于 2012-4-28 13:54
能来个图片吗
我不会脚本
谢谢
  1. $pic_no_moveid = 999#这里设置当XX号开关打开的时候不可走路。
  2. #==============================================================================
  3. # ■ Game_Player
  4. #------------------------------------------------------------------------------
  5. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  6. # 本类的实例请参考 $game_player。
  7. #==============================================================================

  8. class Game_Player < Game_Character
  9.   #--------------------------------------------------------------------------
  10.   # ● 画面更新
  11.   #--------------------------------------------------------------------------
  12.   def update
  13.     # 本地变量记录移动信息
  14.     last_moving = moving?
  15.     # 移动中、事件执行中、强制移动路线中、
  16.     # 信息窗口一个也不显示的时候
  17.     unless moving? or $game_system.map_interpreter.running? or
  18.            @move_route_forcing or $game_temp.message_window_showing
  19.       # 如果方向键被按下、主角就朝那个方向移动
  20.       if !$game_switches[$pic_no_moveid]
  21.       case Input.dir4
  22.       when 2
  23.         move_down
  24.       when 4
  25.         move_left
  26.       when 6
  27.         move_right
  28.       when 8
  29.         move_up
  30.       end
  31.       end
  32.     end
  33.     # 本地变量记忆坐标
  34.     last_real_x = @real_x
  35.     last_real_y = @real_y
  36.     super
  37.     # 角色向下移动、画面上的位置在中央下方的情况下
  38.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  39.       # 画面向下卷动
  40.       $game_map.scroll_down(@real_y - last_real_y)
  41.     end
  42.     # 角色向左移动、画面上的位置在中央左方的情况下
  43.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  44.       # 画面向左卷动
  45.       $game_map.scroll_left(last_real_x - @real_x)
  46.     end
  47.     # 角色向右移动、画面上的位置在中央右方的情况下
  48.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  49.       # 画面向右卷动
  50.       $game_map.scroll_right(@real_x - last_real_x)
  51.     end
  52.     # 角色向上移动、画面上的位置在中央上方的情况下
  53.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  54.       # 画面向上卷动
  55.       $game_map.scroll_up(last_real_y - @real_y)
  56.     end
  57.     # 不在移动中的情况下
  58.     unless moving?
  59.       # 上次主角移动中的情况
  60.       if last_moving
  61.         # 与同位置的事件接触就判定为事件启动
  62.         result = check_event_trigger_here([1,2])
  63.         # 没有可以启动的事件的情况下
  64.         if result == false
  65.           # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  66.           unless $DEBUG and Input.press?(Input::CTRL)
  67.             # 遇敌计数下降
  68.             if @encounter_count > 0
  69.               @encounter_count -= 1
  70.             end
  71.           end
  72.         end
  73.       end
  74.       # 按下 C 键的情况下
  75.       if Input.trigger?(Input::C)
  76.         # 判定为同位置以及正面的事件启动
  77.         check_event_trigger_here([0])
  78.         check_event_trigger_there([0,1,2])
  79.       end
  80.     end
  81.   end
  82. end
复制代码
其实也就是该了21行
设置好开关.
然后显示图片时候顺便打开下开关吧= =




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1