屏蔽
以下引用此ID只用一次于2008-6-20 10:13:37的发言:
其实何必这么麻烦,要达到精灵的效果根本不必大动干戈.
你原来的东西不必改,只需要将 设置移动路线的向上移动用脚本来调用Game_Character里的向上移动,因为它可以自行判断出前方是否可以移动,而且不卡.
如:
条件分歧 $game_player.passable?($game_map.events[x].x, $game_map.events[x].y, 8)
事件第3页-脚本:$game_map.events[x].move_up
除此之外的场合
$game_map.events[x].turn_random
分歧结束.
你可以试试看.解决了你之前所不能移动的问题`
以下引用TERENCE于2008-6-19 22:51:03的发言:
多定义新的passable?叫new_passable?
貼在main前即可
复制代码
- class Game_Character
- #--------------------------------------------------------------------------
- # ● 新通行判定方法
- # x : X 坐标
- # y : Y 坐标
- # d : 方向 (0,2,4,6,8) ※ 0 = 全方向不能通行的情况判定 (跳跃用)
- #--------------------------------------------------------------------------
- def new_passable?(x, y, d)
- # 求得新的坐标
- new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
- new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
- # 坐标在地图以外的情况
- unless $game_map.valid?(new_x, new_y)
- # 不能通行
- return false
- end
- # 穿透是 ON 的情况下
- if @through
- # 可以通行
- return true
- end
- # 移动者的元件无法来到指定方向的情况下
- unless $game_map.passable?(x, y, d, self)
- # 通行不可
- return false
- end
- # 从指定方向不能进入到移动处的元件的情况下
- unless $game_map.passable?(new_x, new_y, 10 - d)
- # 不能通行
- return false
- end
- # 循环全部事件
- for event in $game_map.events.values
- # 事件坐标于移动目标坐标一致的情况下
- if event.x == new_x and event.y == new_y
- # 穿透为 ON
- unless event.through
- # 自己就是事件的情况下
- if self != $game_player
- # 不能通行
- return false
- end
- # 自己是主角、对方的图形是角色的情况下
- if event.character_name != ""
- # 不能通行
- return true
- end
- end
- end
- end
- # 主角的坐标与移动目标坐标一致的情况下
- if $game_player.x == new_x and $game_player.y == new_y
- # 穿透为 ON
- unless $game_player.through
- # 自己的图形是角色的情况下
- if @character_name != ""
- # 不能通行
- return false
- end
- end
- end
- # 可以通行
- return true
- end
- end
调用方式:
$game_player.new_passable?($game_map.events[a].x,$game_map.events[a].y,方向)
范例:
http://rpg.blue/upload_program/files/Project2_94344311.rar
以下引用精灵使者于2008-6-20 10:54:09的发言:
察察的那个判断有问题,有障碍的时候仅仅挡住了一个人,而不是所有人都不可行动。
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |