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

Project1

 找回密码
 注册会员
搜索
楼主: xiarongshan
打印 上一主题 下一主题

400分求向某方向一直走的脚本

 关闭 [复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-1-6
帖子
1139
11
 楼主| 发表于 2008-6-9 01:10:27 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

12
发表于 2008-6-9 01:10:29 | 只看该作者
万恶的程序啊~~
http://rpg.blue/upload_program/files/吃豆豆_93373812.rar

速度是绝对快的,就是敌人有点牛X
地图..
等等细活
反正LZ先看
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-1-6
帖子
1139
13
 楼主| 发表于 2008-6-9 01:14:19 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

14
发表于 2008-6-9 01:33:20 | 只看该作者
以下引用xiarongshan于2008-6-8 17:14:19的发言:


以下引用yangff于2008-6-8 17:10:29的发言:

万恶的程序啊~~
http://rpg.blue/upload_program/files/吃豆豆_93373812.rar


我做的比这个强多了

做的基础脚本嘛。
就是里面对“·核心” 的修改就是了
不过不大符合要求 {/hx}
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
41 小时
注册时间
2008-3-5
帖子
2072
15
发表于 2008-6-9 01:33:31 | 只看该作者
临时写的,有错别怪

  1. #==============================================================================
  2. # ■ Game_Player
  3. #------------------------------------------------------------------------------
  4. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  5. # 本类的实例请参考 $game_player。
  6. #==============================================================================

  7. class Game_Player < Game_Character
  8.   #--------------------------------------------------------------------------
  9.   # ● 恒量
  10.   #--------------------------------------------------------------------------
  11.   CENTER_X = (320 - 16) * 4   # 画面中央的 X 坐标 * 4
  12.   CENTER_Y = (240 - 16) * 4   # 画面中央的 Y 坐标 * 4
  13.   #--------------------------------------------------------------------------
  14.   # ● 可以通行判定
  15.   #     x : X 坐标
  16.   #     y : Y 坐标
  17.   #     d : 方向 (0,2,4,6,8)  ※ 0 = 全方向不能通行的情况判定 (跳跃用)
  18.   #--------------------------------------------------------------------------
  19.   def passable?(x, y, d)
  20.     # 求得新的坐标
  21.     new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  22.     new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
  23.     # 坐标在地图外的情况下
  24.     unless $game_map.valid?(new_x, new_y)
  25.       # 不能通行
  26.       return false
  27.     end
  28.     # 调试模式为 ON 并且 按下 CTRL 键的情况下
  29.     if $DEBUG and Input.press?(Input::CTRL)
  30.       # 可以通行
  31.       return true
  32.     end
  33.     super
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 像通到画面中央一样的设置地图的显示位置
  37.   #--------------------------------------------------------------------------
  38.   def center(x, y)
  39.     max_x = ($game_map.width - 20) * 128
  40.     max_y = ($game_map.height - 15) * 128
  41.     $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
  42.     $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 向指定的位置移动
  46.   #     x : X 座標
  47.   #     y : Y 座標
  48.   #--------------------------------------------------------------------------
  49.   def moveto(x, y)
  50.     super
  51.     # 自连接
  52.     center(x, y)
  53.     # 生成遇敌计数
  54.     make_encounter_count
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 增加步数
  58.   #--------------------------------------------------------------------------
  59.   def increase_steps
  60.     super
  61.     # 不是强制移动路线的场合
  62.     unless @move_route_forcing
  63.       # 增加步数
  64.       $game_party.increase_steps
  65.       # 步数是偶数的情况下
  66.       if $game_party.steps % 2 == 0
  67.         # 检查连续伤害
  68.         $game_party.check_map_slip_damage
  69.       end
  70.     end
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 获取遇敌计数
  74.   #--------------------------------------------------------------------------
  75.   def encounter_count
  76.     return @encounter_count
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● 生成遇敌计数
  80.   #--------------------------------------------------------------------------
  81.   def make_encounter_count
  82.     # 两种颜色震动的图像
  83.     if $game_map.map_id != 0
  84.       n = $game_map.encounter_step
  85.       @encounter_count = rand(n) + rand(n) + 1
  86.     end
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 刷新
  90.   #--------------------------------------------------------------------------
  91.   def refresh
  92.     # 同伴人数为 0 的情况下
  93.     if $game_party.actors.size == 0
  94.       # 清除角色的文件名及对像
  95.       @character_name = ""
  96.       @character_hue = 0
  97.       # 分支结束
  98.       return
  99.     end
  100.     # 获取带头的角色
  101.     actor = $game_party.actors[0]
  102.     # 设置角色的文件名及对像
  103.     @character_name = actor.character_name
  104.     @character_hue = actor.character_hue
  105.     # 初始化不透明度和合成方式子
  106.     @opacity = 255
  107.     @blend_type = 0
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 同位置的事件启动判定
  111.   #--------------------------------------------------------------------------
  112.   def check_event_trigger_here(triggers)
  113.     result = false
  114.     # 事件执行中的情况下
  115.     if $game_system.map_interpreter.running?
  116.       return result
  117.     end
  118.     # 全部事件的循环
  119.     for event in $game_map.events.values
  120.       # 事件坐标与目标一致的情况下
  121.       if event.x == @x and event.y == @y and triggers.include?(event.trigger)
  122.         # 跳跃中以外的情况下、启动判定是同位置的事件
  123.         if not event.jumping? and event.over_trigger?
  124.           event.start
  125.           result = true
  126.         end
  127.       end
  128.     end
  129.     return result
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 正面事件的启动判定
  133.   #--------------------------------------------------------------------------
  134.   def check_event_trigger_there(triggers)
  135.     result = false
  136.     # 事件执行中的情况下
  137.     if $game_system.map_interpreter.running?
  138.       return result
  139.     end
  140.     # 计算正面坐标
  141.     new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  142.     new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  143.     # 全部事件的循环
  144.     for event in $game_map.events.values
  145.       # 事件坐标与目标一致的情况下
  146.       if event.x == new_x and event.y == new_y and
  147.          triggers.include?(event.trigger)
  148.         # 跳跃中以外的情况下、启动判定是正面的事件
  149.         if not event.jumping? and not event.over_trigger?
  150.           event.start
  151.           result = true
  152.         end
  153.       end
  154.     end
  155.     # 找不到符合条件的事件的情况下
  156.     if result == false
  157.       # 正面的元件是计数器的情况下
  158.       if $game_map.counter?(new_x, new_y)
  159.         # 计算 1 元件里侧的坐标
  160.         new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  161.         new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  162.         # 全事件的循环
  163.         for event in $game_map.events.values
  164.           # 事件坐标与目标一致的情况下
  165.           if event.x == new_x and event.y == new_y and
  166.              triggers.include?(event.trigger)
  167.             # 跳跃中以外的情况下、启动判定是正面的事件
  168.             if not event.jumping? and not event.over_trigger?
  169.               event.start
  170.               result = true
  171.             end
  172.           end
  173.         end
  174.       end
  175.     end
  176.     return result
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 接触事件启动判定
  180.   #--------------------------------------------------------------------------
  181.   def check_event_trigger_touch(x, y)
  182.     result = false
  183.     # 事件执行中的情况下
  184.     if $game_system.map_interpreter.running?
  185.       return result
  186.     end
  187.     # 全事件的循环
  188.     for event in $game_map.events.values
  189.       # 事件坐标与目标一致的情况下
  190.       if event.x == x and event.y == y and [1,2].include?(event.trigger)
  191.         # 跳跃中以外的情况下、启动判定是正面的事件
  192.         if not event.jumping? and not event.over_trigger?
  193.           event.start
  194.           result = true
  195.         end
  196.       end
  197.     end
  198.     return result
  199.   end
  200.   #-------------------------------------------------------------------------
  201.   def move_false
  202.     @move_down = false
  203.     @move_left = false
  204.     @move_right = false
  205.     @move_up = false
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● 画面更新
  209.   #--------------------------------------------------------------------------
  210.   def update
  211.     # 本地变量记录移动信息
  212.     last_moving = moving?
  213.     # 移动中、事件执行中、强制移动路线中、
  214.     # 信息窗口一个也不显示的时候
  215.     unless moving? or $game_system.map_interpreter.running? or
  216.            @move_route_forcing or $game_temp.message_window_showing
  217.       # 如果方向键被按下、主角就朝那个方向移动
  218.       case Input.dir4
  219.       when 2
  220.         move_false
  221.         @move_down = true
  222.       when 4
  223.         move_false
  224.         @move_left = true
  225.       when 6
  226.         move_false
  227.         @move_right = true
  228.       when 8
  229.         move_false
  230.         @move_up = true
  231.       end
  232.       if @move_down
  233.         move_down
  234.       elsif @move_up
  235.         move_up
  236.       elsif @move_right
  237.         move_right
  238.       elsif @move_left
  239.         move_left
  240.       end
  241.     end
  242.    
  243.     # 本地变量记忆坐标
  244.     last_real_x = @real_x
  245.     last_real_y = @real_y
  246.     super
  247.     # 角色向下移动、画面上的位置在中央下方的情况下
  248.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  249.       # 画面向下卷动
  250.       $game_map.scroll_down(@real_y - last_real_y)
  251.     end
  252.     # 角色向左移动、画面上的位置在中央左方的情况下
  253.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  254.       # 画面向左卷动
  255.       $game_map.scroll_left(last_real_x - @real_x)
  256.     end
  257.     # 角色向右移动、画面上的位置在中央右方的情况下
  258.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  259.       # 画面向右卷动
  260.       $game_map.scroll_right(@real_x - last_real_x)
  261.     end
  262.     # 角色向上移动、画面上的位置在中央上方的情况下
  263.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  264.       # 画面向上卷动
  265.       $game_map.scroll_up(last_real_y - @real_y)
  266.     end
  267.     # 不在移动中的情况下
  268.     unless moving?
  269.       # 上次主角移动中的情况
  270.       if last_moving
  271.         # 与同位置的事件接触就判定为事件启动
  272.         result = check_event_trigger_here([1,2])
  273.         # 没有可以启动的事件的情况下
  274.         if result == false
  275.           # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  276.           unless $DEBUG and Input.press?(Input::CTRL)
  277.             # 遇敌计数下降
  278.             if @encounter_count > 0
  279.               @encounter_count -= 1
  280.             end
  281.           end
  282.         end
  283.       end
  284.       # 按下 C 键的情况下
  285.       if Input.trigger?(Input::C)
  286.         # 判定为同位置以及正面的事件启动
  287.         check_event_trigger_here([0])
  288.         check_event_trigger_there([0,1,2])
  289.       end
  290.     end
  291.   end
  292. end
复制代码
你它囧一字母君谁记得……
当时那把剑离我的喉咙只有0.01工分。可是一柱香之后,这个女主人会深深的爱上我,虽然本人平生说了无数的谎话,可是这句最有效:“你应该这么做,我也应该死。
曾经有一取ID的机会放在我面前,我没有珍惜,等我失去的时候我才后悔莫及,人世间最痛苦的事莫过于此。你的剑在我的咽喉上割下去吧!不用再犹豫了!如果上天能够给我一个再来一次的机会,我绝对会取个汉字君。如果非要给这ID加点修饰的话,我希望是……红色加粗……

回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-5-23
帖子
675
16
发表于 2008-6-9 02:08:56 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-1-6
帖子
1139
17
 楼主| 发表于 2008-6-9 16:26:47 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
41 小时
注册时间
2008-3-5
帖子
2072
18
发表于 2008-6-9 18:15:24 | 只看该作者
吃豆子用行走规则脚本~~~~~~{/tp}

  1. #==============================================================================
  2. # ■ Game_Player
  3. #------------------------------------------------------------------------------
  4. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  5. # 本类的实例请参考 $game_player。
  6. #==============================================================================

  7. class Game_Player < Game_Character
  8.   #--------------------------------------------------------------------------
  9.   # ● 恒量
  10.   #--------------------------------------------------------------------------
  11.   CENTER_X = (320 - 16) * 4   # 画面中央的 X 坐标 * 4
  12.   CENTER_Y = (240 - 16) * 4   # 画面中央的 Y 坐标 * 4
  13.   #--------------------------------------------------------------------------
  14.   # ● 可以通行判定
  15.   #     x : X 坐标
  16.   #     y : Y 坐标
  17.   #     d : 方向 (0,2,4,6,8)  ※ 0 = 全方向不能通行的情况判定 (跳跃用)
  18.   #--------------------------------------------------------------------------
  19.   def passable?(x, y, d)
  20.     # 求得新的坐标
  21.     new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  22.     new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
  23.     # 坐标在地图外的情况下
  24.     unless $game_map.valid?(new_x, new_y)
  25.       # 不能通行
  26.       return false
  27.     end
  28.     # 调试模式为 ON 并且 按下 CTRL 键的情况下
  29.     if $DEBUG and Input.press?(Input::CTRL)
  30.       # 可以通行
  31.       return true
  32.     end
  33.     super
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 像通到画面中央一样的设置地图的显示位置
  37.   #--------------------------------------------------------------------------
  38.   def center(x, y)
  39.     max_x = ($game_map.width - 20) * 128
  40.     max_y = ($game_map.height - 15) * 128
  41.     $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
  42.     $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 向指定的位置移动
  46.   #     x : X 座標
  47.   #     y : Y 座標
  48.   #--------------------------------------------------------------------------
  49.   def moveto(x, y)
  50.     super
  51.     # 自连接
  52.     center(x, y)
  53.     # 生成遇敌计数
  54.     make_encounter_count
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 增加步数
  58.   #--------------------------------------------------------------------------
  59.   def increase_steps
  60.     super
  61.     # 不是强制移动路线的场合
  62.     unless @move_route_forcing
  63.       # 增加步数
  64.       $game_party.increase_steps
  65.       # 步数是偶数的情况下
  66.       if $game_party.steps % 2 == 0
  67.         # 检查连续伤害
  68.         $game_party.check_map_slip_damage
  69.       end
  70.     end
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 获取遇敌计数
  74.   #--------------------------------------------------------------------------
  75.   def encounter_count
  76.     return @encounter_count
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● 生成遇敌计数
  80.   #--------------------------------------------------------------------------
  81.   def make_encounter_count
  82.     # 两种颜色震动的图像
  83.     if $game_map.map_id != 0
  84.       n = $game_map.encounter_step
  85.       @encounter_count = rand(n) + rand(n) + 1
  86.     end
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 刷新
  90.   #--------------------------------------------------------------------------
  91.   def refresh
  92.     # 同伴人数为 0 的情况下
  93.     if $game_party.actors.size == 0
  94.       # 清除角色的文件名及对像
  95.       @character_name = ""
  96.       @character_hue = 0
  97.       # 分支结束
  98.       return
  99.     end
  100.     # 获取带头的角色
  101.     actor = $game_party.actors[0]
  102.     # 设置角色的文件名及对像
  103.     @character_name = actor.character_name
  104.     @character_hue = actor.character_hue
  105.     # 初始化不透明度和合成方式子
  106.     @opacity = 255
  107.     @blend_type = 0
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 同位置的事件启动判定
  111.   #--------------------------------------------------------------------------
  112.   def check_event_trigger_here(triggers)
  113.     result = false
  114.     # 事件执行中的情况下
  115.     if $game_system.map_interpreter.running?
  116.       return result
  117.     end
  118.     # 全部事件的循环
  119.     for event in $game_map.events.values
  120.       # 事件坐标与目标一致的情况下
  121.       if event.x == @x and event.y == @y and triggers.include?(event.trigger)
  122.         # 跳跃中以外的情况下、启动判定是同位置的事件
  123.         if not event.jumping? and event.over_trigger?
  124.           event.start
  125.           result = true
  126.         end
  127.       end
  128.     end
  129.     return result
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 正面事件的启动判定
  133.   #--------------------------------------------------------------------------
  134.   def check_event_trigger_there(triggers)
  135.     result = false
  136.     # 事件执行中的情况下
  137.     if $game_system.map_interpreter.running?
  138.       return result
  139.     end
  140.     # 计算正面坐标
  141.     new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  142.     new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  143.     # 全部事件的循环
  144.     for event in $game_map.events.values
  145.       # 事件坐标与目标一致的情况下
  146.       if event.x == new_x and event.y == new_y and
  147.          triggers.include?(event.trigger)
  148.         # 跳跃中以外的情况下、启动判定是正面的事件
  149.         if not event.jumping? and not event.over_trigger?
  150.           event.start
  151.           result = true
  152.         end
  153.       end
  154.     end
  155.     # 找不到符合条件的事件的情况下
  156.     if result == false
  157.       # 正面的元件是计数器的情况下
  158.       if $game_map.counter?(new_x, new_y)
  159.         # 计算 1 元件里侧的坐标
  160.         new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  161.         new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  162.         # 全事件的循环
  163.         for event in $game_map.events.values
  164.           # 事件坐标与目标一致的情况下
  165.           if event.x == new_x and event.y == new_y and
  166.              triggers.include?(event.trigger)
  167.             # 跳跃中以外的情况下、启动判定是正面的事件
  168.             if not event.jumping? and not event.over_trigger?
  169.               event.start
  170.               result = true
  171.             end
  172.           end
  173.         end
  174.       end
  175.     end
  176.     return result
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 接触事件启动判定
  180.   #--------------------------------------------------------------------------
  181.   def check_event_trigger_touch(x, y)
  182.     result = false
  183.     # 事件执行中的情况下
  184.     if $game_system.map_interpreter.running?
  185.       return result
  186.     end
  187.     # 全事件的循环
  188.     for event in $game_map.events.values
  189.       # 事件坐标与目标一致的情况下
  190.       if event.x == x and event.y == y and [1,2].include?(event.trigger)
  191.         # 跳跃中以外的情况下、启动判定是正面的事件
  192.         if not event.jumping? and not event.over_trigger?
  193.           event.start
  194.           result = true
  195.         end
  196.       end
  197.     end
  198.     return result
  199.   end
  200.   #-------------------------------------------------------------------------
  201.   def move_false
  202.     @move_down = false
  203.     @move_left = false
  204.     @move_right = false
  205.     @move_up = false
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● 画面更新
  209.   #--------------------------------------------------------------------------
  210.   def update
  211.     # 本地变量记录移动信息
  212.     last_moving = moving?
  213.     # 移动中、事件执行中、强制移动路线中、
  214.     # 信息窗口一个也不显示的时候
  215.     unless moving? or $game_system.map_interpreter.running? or
  216.            @move_route_forcing or $game_temp.message_window_showing
  217.       # 如果方向键被按下、主角就朝那个方向移动
  218.       case Input.dir4
  219.       when 2
  220.         if $game_map.passable?(self.x,self.y+1,8) and $game_map.passable?(self.x,self.y,2)
  221.           move_false
  222.           @move_down = true
  223.         end
  224.       when 4
  225.         if $game_map.passable?(self.x-1,self.y,6) and $game_map.passable?(self.x,self.y,4)
  226.           move_false
  227.           @move_left = true
  228.         end
  229.       when 6
  230.         if $game_map.passable?(self.x+1,self.y,4) and $game_map.passable?(self.x,self.y,6)
  231.           move_false
  232.           @move_right = true
  233.         end
  234.       when 8
  235.         if $game_map.passable?(self.x,self.y-1,2) and $game_map.passable?(self.x,self.y,8)
  236.           move_false
  237.           @move_up = true
  238.         end
  239.       end
  240.       if @move_down
  241.         move_down
  242.       elsif @move_up
  243.         move_up
  244.       elsif @move_right
  245.         move_right
  246.       elsif @move_left
  247.         move_left
  248.       end
  249.     end
  250.    
  251.     # 本地变量记忆坐标
  252.     last_real_x = @real_x
  253.     last_real_y = @real_y
  254.     super
  255.     # 角色向下移动、画面上的位置在中央下方的情况下
  256.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  257.       # 画面向下卷动
  258.       $game_map.scroll_down(@real_y - last_real_y)
  259.     end
  260.     # 角色向左移动、画面上的位置在中央左方的情况下
  261.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  262.       # 画面向左卷动
  263.       $game_map.scroll_left(last_real_x - @real_x)
  264.     end
  265.     # 角色向右移动、画面上的位置在中央右方的情况下
  266.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  267.       # 画面向右卷动
  268.       $game_map.scroll_right(@real_x - last_real_x)
  269.     end
  270.     # 角色向上移动、画面上的位置在中央上方的情况下
  271.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  272.       # 画面向上卷动
  273.       $game_map.scroll_up(last_real_y - @real_y)
  274.     end
  275.     # 不在移动中的情况下
  276.     unless moving?
  277.       # 上次主角移动中的情况
  278.       if last_moving
  279.         # 与同位置的事件接触就判定为事件启动
  280.         result = check_event_trigger_here([1,2])
  281.         # 没有可以启动的事件的情况下
  282.         if result == false
  283.           # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  284.           unless $DEBUG and Input.press?(Input::CTRL)
  285.             # 遇敌计数下降
  286.             if @encounter_count > 0
  287.               @encounter_count -= 1
  288.             end
  289.           end
  290.         end
  291.       end
  292.       # 按下 C 键的情况下
  293.       if Input.trigger?(Input::C)
  294.         # 判定为同位置以及正面的事件启动
  295.         check_event_trigger_here([0])
  296.         check_event_trigger_there([0,1,2])
  297.       end
  298.     end
  299.   end
  300. end
复制代码


四方向的通行判定已完成.
9 5 的位置我不理解是什么意思?
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
版主对此帖的认可:『其实小夏是转给这个脚本强人的 - -』,积分『+200』。
你它囧一字母君谁记得……
当时那把剑离我的喉咙只有0.01工分。可是一柱香之后,这个女主人会深深的爱上我,虽然本人平生说了无数的谎话,可是这句最有效:“你应该这么做,我也应该死。
曾经有一取ID的机会放在我面前,我没有珍惜,等我失去的时候我才后悔莫及,人世间最痛苦的事莫过于此。你的剑在我的咽喉上割下去吧!不用再犹豫了!如果上天能够给我一个再来一次的机会,我绝对会取个汉字君。如果非要给这ID加点修饰的话,我希望是……红色加粗……

回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-1-6
帖子
1139
19
 楼主| 发表于 2008-6-9 19:55:21 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
41 小时
注册时间
2008-3-5
帖子
2072
20
发表于 2008-6-9 20:06:52 | 只看该作者
加了95的位置不能往下的功能

增加了吃豆子专用的自动寻路的功能,开关23号控制开启
这样角色就不能停下了,走到前方有障碍,自动找路走

祝你做个好的吃豆子游戏~


  1. #==============================================================================
  2. # ■ Game_Player
  3. #------------------------------------------------------------------------------
  4. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  5. # 本类的实例请参考 $game_player。
  6. #==============================================================================

  7. class Game_Player < Game_Character
  8.   #--------------------------------------------------------------------------
  9.   # ● 恒量
  10.   #--------------------------------------------------------------------------
  11.   CENTER_X = (320 - 16) * 4   # 画面中央的 X 坐标 * 4
  12.   CENTER_Y = (240 - 16) * 4   # 画面中央的 Y 坐标 * 4
  13.   #--------------------------------------------------------------------------
  14.   # ● 可以通行判定
  15.   #     x : X 坐标
  16.   #     y : Y 坐标
  17.   #     d : 方向 (0,2,4,6,8)  ※ 0 = 全方向不能通行的情况判定 (跳跃用)
  18.   #--------------------------------------------------------------------------
  19.   def passable?(x, y, d)
  20.     # 求得新的坐标
  21.     new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  22.     new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
  23.     # 坐标在地图外的情况下
  24.     unless $game_map.valid?(new_x, new_y)
  25.       # 不能通行
  26.       return false
  27.     end
  28.     # 调试模式为 ON 并且 按下 CTRL 键的情况下
  29.     if $DEBUG and Input.press?(Input::CTRL)
  30.       # 可以通行
  31.       return true
  32.     end
  33.     super
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 像通到画面中央一样的设置地图的显示位置
  37.   #--------------------------------------------------------------------------
  38.   def center(x, y)
  39.     max_x = ($game_map.width - 20) * 128
  40.     max_y = ($game_map.height - 15) * 128
  41.     $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
  42.     $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 向指定的位置移动
  46.   #     x : X 座標
  47.   #     y : Y 座標
  48.   #--------------------------------------------------------------------------
  49.   def moveto(x, y)
  50.     super
  51.     # 自连接
  52.     center(x, y)
  53.     # 生成遇敌计数
  54.     make_encounter_count
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 增加步数
  58.   #--------------------------------------------------------------------------
  59.   def increase_steps
  60.     super
  61.     # 不是强制移动路线的场合
  62.     unless @move_route_forcing
  63.       # 增加步数
  64.       $game_party.increase_steps
  65.       # 步数是偶数的情况下
  66.       if $game_party.steps % 2 == 0
  67.         # 检查连续伤害
  68.         $game_party.check_map_slip_damage
  69.       end
  70.     end
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 获取遇敌计数
  74.   #--------------------------------------------------------------------------
  75.   def encounter_count
  76.     return @encounter_count
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● 生成遇敌计数
  80.   #--------------------------------------------------------------------------
  81.   def make_encounter_count
  82.     # 两种颜色震动的图像
  83.     if $game_map.map_id != 0
  84.       n = $game_map.encounter_step
  85.       @encounter_count = rand(n) + rand(n) + 1
  86.     end
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 刷新
  90.   #--------------------------------------------------------------------------
  91.   def refresh
  92.     # 同伴人数为 0 的情况下
  93.     if $game_party.actors.size == 0
  94.       # 清除角色的文件名及对像
  95.       @character_name = ""
  96.       @character_hue = 0
  97.       # 分支结束
  98.       return
  99.     end
  100.     # 获取带头的角色
  101.     actor = $game_party.actors[0]
  102.     # 设置角色的文件名及对像
  103.     @character_name = actor.character_name
  104.     @character_hue = actor.character_hue
  105.     # 初始化不透明度和合成方式子
  106.     @opacity = 255
  107.     @blend_type = 0
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 同位置的事件启动判定
  111.   #--------------------------------------------------------------------------
  112.   def check_event_trigger_here(triggers)
  113.     result = false
  114.     # 事件执行中的情况下
  115.     if $game_system.map_interpreter.running?
  116.       return result
  117.     end
  118.     # 全部事件的循环
  119.     for event in $game_map.events.values
  120.       # 事件坐标与目标一致的情况下
  121.       if event.x == @x and event.y == @y and triggers.include?(event.trigger)
  122.         # 跳跃中以外的情况下、启动判定是同位置的事件
  123.         if not event.jumping? and event.over_trigger?
  124.           event.start
  125.           result = true
  126.         end
  127.       end
  128.     end
  129.     return result
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 正面事件的启动判定
  133.   #--------------------------------------------------------------------------
  134.   def check_event_trigger_there(triggers)
  135.     result = false
  136.     # 事件执行中的情况下
  137.     if $game_system.map_interpreter.running?
  138.       return result
  139.     end
  140.     # 计算正面坐标
  141.     new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  142.     new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  143.     # 全部事件的循环
  144.     for event in $game_map.events.values
  145.       # 事件坐标与目标一致的情况下
  146.       if event.x == new_x and event.y == new_y and
  147.          triggers.include?(event.trigger)
  148.         # 跳跃中以外的情况下、启动判定是正面的事件
  149.         if not event.jumping? and not event.over_trigger?
  150.           event.start
  151.           result = true
  152.         end
  153.       end
  154.     end
  155.     # 找不到符合条件的事件的情况下
  156.     if result == false
  157.       # 正面的元件是计数器的情况下
  158.       if $game_map.counter?(new_x, new_y)
  159.         # 计算 1 元件里侧的坐标
  160.         new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  161.         new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  162.         # 全事件的循环
  163.         for event in $game_map.events.values
  164.           # 事件坐标与目标一致的情况下
  165.           if event.x == new_x and event.y == new_y and
  166.              triggers.include?(event.trigger)
  167.             # 跳跃中以外的情况下、启动判定是正面的事件
  168.             if not event.jumping? and not event.over_trigger?
  169.               event.start
  170.               result = true
  171.             end
  172.           end
  173.         end
  174.       end
  175.     end
  176.     return result
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 接触事件启动判定
  180.   #--------------------------------------------------------------------------
  181.   def check_event_trigger_touch(x, y)
  182.     result = false
  183.     # 事件执行中的情况下
  184.     if $game_system.map_interpreter.running?
  185.       return result
  186.     end
  187.     # 全事件的循环
  188.     for event in $game_map.events.values
  189.       # 事件坐标与目标一致的情况下
  190.       if event.x == x and event.y == y and [1,2].include?(event.trigger)
  191.         # 跳跃中以外的情况下、启动判定是正面的事件
  192.         if not event.jumping? and not event.over_trigger?
  193.           event.start
  194.           result = true
  195.         end
  196.       end
  197.     end
  198.     return result
  199.   end
  200.   #-------------------------------------------------------------------------
  201.   def move(move)
  202.     @move_down = false
  203.     @move_left = false
  204.     @move_right = false
  205.     @move_up = false
  206.     case move
  207.     when 2
  208.       @move_down = true
  209.     when 4
  210.       @move_left = true
  211.     when 6
  212.       @move_right = true
  213.     when 8
  214.       @move_up = true
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   def auto_move(move)
  219.     case move
  220.     when 2
  221.       if $game_map.passable?(self.x,self.y+1,8) and $game_map.passable?(self.x,self.y,2)
  222.         return true
  223.       end
  224.     when 8
  225.       if $game_map.passable?(self.x,self.y-1,2) and $game_map.passable?(self.x,self.y,8)
  226.         return true
  227.       end
  228.     when 4
  229.       if $game_map.passable?(self.x-1,self.y,6) and $game_map.passable?(self.x,self.y,4)
  230.         return true
  231.       end
  232.     when 6
  233.       if $game_map.passable?(self.x+1,self.y,4) and $game_map.passable?(self.x,self.y,6)
  234.         return true
  235.       end
  236.     end
  237.     return false
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ● 画面更新
  241.   #--------------------------------------------------------------------------
  242.   def update
  243.     # 本地变量记录移动信息
  244.     last_moving = moving?
  245.     # 移动中、事件执行中、强制移动路线中、
  246.     # 信息窗口一个也不显示的时候
  247.     unless moving? or $game_system.map_interpreter.running? or
  248.            @move_route_forcing or $game_temp.message_window_showing
  249.       # 如果方向键被按下、主角就朝那个方向移动
  250.       case Input.dir4
  251.       when 2
  252.         if auto_move(2)
  253.           move = true
  254.           move(2)
  255.         end
  256.       when 4
  257.         if auto_move(4) #左
  258.           move = true
  259.           move(4)
  260.         end
  261.       when 6
  262.         if auto_move(6) #右
  263.           move = true
  264.           move(6)
  265.         end
  266.       when 8
  267.         if auto_move(8) #上
  268.           move = true
  269.           move(8)
  270.         end
  271.       end
  272.         
  273.       
  274.       if !move and $game_switches[23] == true
  275.         if self.direction == 2
  276.           if auto_move(2)
  277.             move(2)
  278.           elsif auto_move(4)
  279.             move(4)
  280.           elsif auto_move(6)
  281.             move(6)
  282.           else
  283.             move(8)
  284.           end
  285.         elsif self.direction == 4
  286.           if auto_move(4)
  287.             move(4)
  288.           elsif auto_move(8)
  289.             move(8)
  290.           elsif auto_move(2)
  291.             move(2)
  292.           else
  293.             move(6)
  294.           end
  295.         elsif self.direction == 6
  296.           if auto_move(6)
  297.             move(6)
  298.           elsif auto_move(2)
  299.             move(2)
  300.           elsif auto_move(8)
  301.             move(8)
  302.           else
  303.             move(4)
  304.           end
  305.         elsif self.direction == 8
  306.           if auto_move(8)
  307.             move(8)
  308.           elsif auto_move(6)
  309.             move(6)
  310.           elsif auto_move(4)
  311.             move(4)
  312.           else
  313.             move(2)
  314.           end
  315.         end
  316.         
  317.       end
  318.       if self.x == 9 and self.y == 5 #下
  319.         @move_down = false
  320.       end
  321.         
  322.       if @move_down
  323.         move_down
  324.       elsif @move_up
  325.         move_up
  326.       elsif @move_right
  327.         move_right
  328.       elsif @move_left
  329.         move_left
  330.       end
  331.     end
  332.    
  333.     # 本地变量记忆坐标
  334.     last_real_x = @real_x
  335.     last_real_y = @real_y
  336.     super
  337.     # 角色向下移动、画面上的位置在中央下方的情况下
  338.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  339.       # 画面向下卷动
  340.       $game_map.scroll_down(@real_y - last_real_y)
  341.     end
  342.     # 角色向左移动、画面上的位置在中央左方的情况下
  343.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  344.       # 画面向左卷动
  345.       $game_map.scroll_left(last_real_x - @real_x)
  346.     end
  347.     # 角色向右移动、画面上的位置在中央右方的情况下
  348.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  349.       # 画面向右卷动
  350.       $game_map.scroll_right(@real_x - last_real_x)
  351.     end
  352.     # 角色向上移动、画面上的位置在中央上方的情况下
  353.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  354.       # 画面向上卷动
  355.       $game_map.scroll_up(last_real_y - @real_y)
  356.     end
  357.     # 不在移动中的情况下
  358.     unless moving?
  359.       # 上次主角移动中的情况
  360.       if last_moving
  361.         # 与同位置的事件接触就判定为事件启动
  362.         result = check_event_trigger_here([1,2])
  363.         # 没有可以启动的事件的情况下
  364.         if result == false
  365.           # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  366.           unless $DEBUG and Input.press?(Input::CTRL)
  367.             # 遇敌计数下降
  368.             if @encounter_count > 0
  369.               @encounter_count -= 1
  370.             end
  371.           end
  372.         end
  373.       end
  374.       # 按下 C 键的情况下
  375.       if Input.trigger?(Input::C)
  376.         # 判定为同位置以及正面的事件启动
  377.         check_event_trigger_here([0])
  378.         check_event_trigger_there([0,1,2])
  379.       end
  380.     end
  381.   end
  382. end
复制代码
你它囧一字母君谁记得……
当时那把剑离我的喉咙只有0.01工分。可是一柱香之后,这个女主人会深深的爱上我,虽然本人平生说了无数的谎话,可是这句最有效:“你应该这么做,我也应该死。
曾经有一取ID的机会放在我面前,我没有珍惜,等我失去的时候我才后悔莫及,人世间最痛苦的事莫过于此。你的剑在我的咽喉上割下去吧!不用再犹豫了!如果上天能够给我一个再来一次的机会,我绝对会取个汉字君。如果非要给这ID加点修饰的话,我希望是……红色加粗……

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-8-3 21:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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