赞 | 0 |
VIP | 1 |
好人卡 | 0 |
积分 | 1 |
经验 | 179136 |
最后登录 | 2013-7-1 |
在线时间 | 9 小时 |
Lv1.梦旅人 查无此人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 9 小时
- 注册时间
- 2006-5-8
- 帖子
- 1399
|
完善版本, 范例中用来处理移动物体对主角冲撞的效果的, 看了下事件不知道这个脚本有什么用, 好象事件就能处理的样子..
- #===============================#
- # EDGE WALKING
- # By Jimme Reashu
- # Version 1
- # Last edit: October 21
- # Always include the Readme file when distributing
- # the script together with the demo. Always.
- # This header may not be removed
- #===============================#
- PLAYER_EDGE = 5
- EVENT_EDGE = 6
- class Game_Character
- alias jimmr_edgewalk_passable? passable?
- def passable?(x,y,d)
- unless (self.is_a?(Game_Event) && $game_switches[EVENT_EDGE] == true) or (self.is_a?(Game_Player) && $game_switches[PLAYER_EDGE] == true)
- return jimmr_edgewalk_passable?(x,y,d)
- else
- $game_switches[EVENT_EDGE] = false if self.is_a?(Game_Event)
- $game_switches[PLAYER_EDGE] = false if self.is_a?(Game_Player)
- 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) and $game_map.valid?(x, y)
- return true
- end
- 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
- unless event.through
- if self != $game_player
- return false
- end
- if event.character_name != ""
- return false
- end
- end
- end
- end
- if $game_player.x == new_x and $game_player.y == new_y
- unless $game_player.through
- if @character_name != ""
- return false
- end
- end
- end
- return true
- end
- end
- end
- class Game_Player < Game_Character
- def passable?(x, y, d)
- new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
- new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
- if $DEBUG and Input.press?(Input::CTRL) and $game_map.valid?(new_x, new_y)
- return true
- end
- super
- end
- end
复制代码 |
|