赞 | 7 |
VIP | 866 |
好人卡 | 185 |
积分 | 32 |
经验 | 130059 |
最后登录 | 2024-10-29 |
在线时间 | 3618 小时 |
Lv3.寻梦者 双子人
- 梦石
- 0
- 星屑
- 3185
- 在线时间
- 3618 小时
- 注册时间
- 2009-4-4
- 帖子
- 4154
|
本帖最后由 hys111111 于 2012-4-17 12:35 编辑
- class Game_Character
-
- alias xy_up move_up
- def move_up(turn_enabled = true)
- if self.is_a?(Game_Player)
- xy_up
- end
- if $game_player.passable?(@x,@y,8) and self.is_a?(Game_Event)
- xy_up
- else
- turn_up
- pd
- end
- end
-
- alias xy_down move_down
- def move_down(turn_enabled = true)
- if self.is_a?(Game_Player)
- xy_down
- end
- if $game_player.passable?(@x,@y,2) and self.is_a?(Game_Event)
- xy_down
- else
- turn_down
- pd
- end
- end
-
- alias xy_left move_left
- def move_left(turn_enabled = true)
- if self.is_a?(Game_Player)
- xy_left
- end
- if $game_player.passable?(@x,@y,4) and self.is_a?(Game_Event)
- xy_left
- else
- turn_left
- pd
- end
- end
-
- alias xy_right move_right
- def move_right(turn_enabled = true)
- if self.is_a?(Game_Player)
- xy_right
- end
- if $game_player.passable?(@x,@y,6) and self.is_a?(Game_Event)
- xy_right
- else
- turn_right
- pd
- end
- end
-
- def pd
- @move_route_waiting = true
- xy_event = {}
- #格式:xy_event = [[A,B],[A,B]]
- #A为事件所在地图,B为事件编号
- xy_event = [[1,3]]#设置部分
-
- for a in 0...xy_event.size
- if xy_event[a][0] == $game_map.map_id and self.is_a?(Game_Event)
- if xy_event[a][1] == @id
- case @direction
- when 2
- xx=@x
- yy=@y+1
- when 4
- xx=@x-1
- yy=@y
- when 6
- xx=@x+1
- yy=@y
- when 8
- xx=@x
- yy=@y-1
- end
- for i in $game_map.events.values
- if xx == i.x and yy == i.y
- case @direction
- when 2
- i.turn_up
- when 4
- i.turn_right
- when 6
- i.turn_left
- when 8
- i.turn_down
- end
- i.start
- end
- end
- end
- end
- end
- end
- end
复制代码 我现在会用alias了,测试无误,可以拿去用了(另外,执行事件的过程事件可以移动哦)
真的就像角色接触事件那样子了。自己再使用试试……已经修复…… |
|