| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2013-6-25 |
| 在线时间 | 687 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 687 小时
- 注册时间
- 2012-10-29
- 回帖
- 1526
|
发表于 2013-2-24 21:31:27
|
显示全部楼层
本帖最后由 j433463 于 2013-2-24 21:34 编辑
试试这个八方向移动脚本如何?最底下那个应该是斜向的处理,您好像只用了上面的部份。- #==============================================================================
- # ■ VXAce-RGSS3-26 8方向移动 [Ver.1.0.0] by Claimh
- #------------------------------------------------------------------------------
- # 8方向の移动が可能となります。
- # 斜め移动ができない时に縦or横に移动できる场合は縦or横に移动するようになります。
- #==============================================================================
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # ● 方向ボタン入力による移动処理
- #--------------------------------------------------------------------------
- def move_by_input
- return if !movable? || $game_map.interpreter.running?
- if [1, 3, 7, 9].include?(Input.dir8)
- case Input.dir8
- when 1; move_diagonal(4, 2)
- when 3; move_diagonal(6, 2)
- when 7; move_diagonal(4, 8)
- when 9; move_diagonal(6, 8)
- end
- return if @move_succeed
- end
- move_straight(Input.dir4) if Input.dir4 > 0
- end
- end
- class Game_CharacterBase
- #--------------------------------------------------------------------------
- # ● 斜めに移动
- # horz : 横方向(4 or 6)
- # vert : 縦方向(2 or 8)
- #--------------------------------------------------------------------------
- alias move_diagonal_8dir move_diagonal
- def move_diagonal(horz, vert)
- if !passable?(@x, @y, horz) and !passable?(@x, @y, vert)
- @move_succeed = false
- return
- end
- return move_straight(horz) if passable?(@x, @y, horz) and !passable?(@x, @y, vert)
- return move_straight(vert) if !passable?(@x, @y, horz) and passable?(@x, @y, vert)
- move_diagonal_8dir(horz, vert)
- end
- end
复制代码 |
评分
-
查看全部评分
|