| 赞 | 168  | 
 
| VIP | 6 | 
 
| 好人卡 | 208 | 
 
| 积分 | 225 | 
 
| 经验 | 137153 | 
 
| 最后登录 | 2025-4-1 | 
 
| 在线时间 | 8598 小时 | 
 
 
 
 
 
Lv5.捕梦者 
	- 梦石
 - 0 
 
        - 星屑
 - 22509 
 
        - 在线时间
 - 8598 小时
 
        - 注册时间
 - 2011-12-31
 
        - 帖子
 - 3361
 
 
 
 | 
	
 本帖最后由 tseyik 于 2012-12-4 18:47 编辑  
 
原網址 
http://artificialprovidence.web.fc2.com/ 
 
8方向移動 
- #==============================================================================
 
 - # ■ RGSS3 8方向移動スクリプト Ver1.01 by 星潟
 
 - #------------------------------------------------------------------------------
 
 - #  プレイヤーキャラクターの8方向移動を可能にします。
 
 - #   その他、プレイヤーの移動に関する一部機能について設定できます。
 
 - #   基本的に機能拡張依頼や競合対応は受け付けておりません。ご了承ください。
 
 - #
 
 - #   更新履歴
 
 - #   Ver1.01 不要な記述一点を削除。
 
 - #           スイッチ切り替えによるダッシュ禁止機能を追加。
 
 - #==============================================================================
 
  
- module MOVE_CONTROL
 
 -   
 
 -   #这个开关on,禁止在八个方向的运动,只可四个方向移动。
 
 -   
 
 -   FOUR_MOVE_SWITCH = 51
 
 -   
 
 -   #这个开关on、禁止的操作的玩家角色。
 
 -   
 
 -   MOVE_SEAL_SWITCH = 52
 
 -   
 
 -   #这个开关on、短跑判断是相反。
 
 -   #(平常時短跑、短跑鍵押下是通常歩行)
 
 -   
 
 -   DASH_REV = 53
 
 -   
 
 -   #这个开关on、禁止使用短跑。
 
 -   #(通过切换开关,、同一地图上
 
 -   #  可分別設定可短跑和禁止短跑的地区)
 
 -   
 
 -   DASH_SEAL = 54
 
 -   
 
 -   #当這变量的数値大于零,则短跑速度进一步增加。
 
 -   
 
 -   DASH_PLUS = 19
 
 -   
 
 - end
 
  
- class Game_CharacterBase
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 移動速度の取得(ダッシュを考慮)
 
 -   #--------------------------------------------------------------------------
 
 -   alias real_move_speed_8direction real_move_speed
 
 -   def real_move_speed
 
 -     if $game_variables[MOVE_CONTROL::DASH_PLUS] > 0
 
 -       dash_plus = 1 + ($game_variables[MOVE_CONTROL::DASH_PLUS] * 0.1)
 
 -       @move_speed + (dash? ? dash_plus : 0)
 
 -     else
 
 -       real_move_speed_8direction
 
 -     end
 
 -   end
 
 - end
 
  
- class Game_Player < Game_Character
 
 -   #--------------------------------------------------------------------------
 
 -   # ● ダッシュ状態判定
 
 -   #--------------------------------------------------------------------------
 
 -   alias dash_rev? dash?
 
 -   def dash?
 
 -     return false if $game_switches[MOVE_CONTROL::DASH_SEAL] == true
 
 -     if $game_switches[MOVE_CONTROL::DASH_REV] == true
 
 -       return false if @move_route_forcing
 
 -       return false if $game_map.disable_dash?
 
 -       return false if vehicle
 
 -       return false if Input.press?(:A)
 
 -       return true
 
 -     else
 
 -       dash_rev?
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 方向ボタン入力による移動処理
 
 -   #--------------------------------------------------------------------------
 
 -   alias move_by_input_8direction move_by_input
 
 -   def move_by_input
 
 -     return if $game_switches[MOVE_CONTROL::MOVE_SEAL_SWITCH] == true
 
 -     if $game_switches[MOVE_CONTROL::FOUR_MOVE_SWITCH] == true
 
 -       move_by_input_8direction
 
 -       return
 
 -     end
 
 -     return if !movable? || $game_map.interpreter.running?
 
 -     if Input.press?(:LEFT) && Input.press?(:DOWN)
 
 -       if passable?(@x, @y, 4) && passable?(@x, @y, 2) &&
 
 -         passable?(@x - 1, @y, 2) && passable?(@x, @y + 1, 4) &&
 
 -         passable?(@x - 1, @y + 1, 6) && passable?(@x - 1, @y + 1, 8)
 
 -         move_diagonal(4, 2)
 
 -       elsif @direction == 4
 
 -         if passable?(@x, @y, 2) && passable?(@x, @y + 1, 8)
 
 -           move_straight(2)
 
 -         elsif passable?(@x, @y, 4) && passable?(@x - 1, @y, 6)
 
 -           move_straight(4)
 
 -         end
 
 -       elsif @direction == 2
 
 -         if passable?(@x, @y, 4) && passable?(@x - 1, @y, 6)
 
 -           move_straight(4)
 
 -         elsif passable?(@x, @y, 2) && passable?(@x, @y + 1, 8)
 
 -           move_straight(2)
 
 -         else
 
 -           move_straight(Input.dir4) if Input.dir4 > 0
 
 -         end
 
 -       else
 
 -         move_straight(Input.dir4) if Input.dir4 > 0
 
 -       end
 
 -     elsif Input.press?(:RIGHT) && Input.press?(:DOWN)
 
 -       if passable?(@x, @y, 6) && passable?(@x, @y, 2) &&
 
 -         passable?(@x + 1, @y, 2) && passable?(@x, @y + 1, 6) &&
 
 -         passable?(@x + 1, @y + 1, 4) && passable?(@x + 1, @y + 1, 8)
 
 -         move_diagonal(6, 2)
 
 -       elsif @direction == 6
 
 -         if passable?(@x, @y, 2) && passable?(@x, @y + 1, 8)
 
 -           move_straight(2)
 
 -         elsif passable?(@x, @y, 6) && passable?(@x + 1, @y, 4)
 
 -           move_straight(6)
 
 -         end
 
 -       elsif @direction == 2
 
 -         if passable?(@x, @y, 6) && passable?(@x + 1, @y, 4)
 
 -           move_straight(6)
 
 -         elsif passable?(@x, @y, 2) && passable?(@x, @y + 1, 8)
 
 -           move_straight(2)
 
 -         else
 
 -           move_straight(Input.dir4) if Input.dir4 > 0
 
 -         end
 
 -       else
 
 -         move_straight(Input.dir4) if Input.dir4 > 0
 
 -       end
 
 -     elsif Input.press?(:LEFT) && Input.press?(:UP)
 
 -       if passable?(@x, @y, 4) && passable?(@x, @y, 8) &&
 
 -         passable?(@x - 1, @y, 8) && passable?(@x, @y - 1, 4) &&
 
 -         passable?(@x - 1, @y - 1, 2) && passable?(@x - 1, @y - 1, 6)
 
 -         move_diagonal(4, 8)
 
 -       elsif @direction == 4
 
 -         if passable?(@x, @y, 8) && passable?(@x, @y - 1, 2)
 
 -           move_straight(8)
 
 -         elsif passable?(@x, @y, 4) && passable?(@x - 1, @y, 6)
 
 -           move_straight(4)
 
 -         else
 
 -           move_straight(Input.dir4) if Input.dir4 > 0
 
 -         end
 
 -       elsif @direction == 8
 
 -         if passable?(@x, @y, 4) && passable?(@x - 1, @y, 6)
 
 -           move_straight(4)
 
 -         elsif passable?(@x, @y, 8) && passable?(@x, @y - 1, 2)
 
 -           move_straight(8)
 
 -         else
 
 -           move_straight(Input.dir4) if Input.dir4 > 0
 
 -         end
 
 -       else
 
 -         move_straight(Input.dir4) if Input.dir4 > 0
 
 -       end
 
 -     elsif Input.press?(:RIGHT) && Input.press?(:UP)
 
 -       if passable?(@x, @y, 6) && passable?(@x, @y, 8) &&
 
 -         passable?(@x + 1, @y, 8) && passable?(@x, @y - 1, 6) &&
 
 -         passable?(@x + 1, @y - 1, 2) && passable?(@x + 1, @y - 1, 4)
 
 -         move_diagonal(6, 8)
 
 -       elsif @direction == 6
 
 -         if passable?(@x, @y, 8) && passable?(@x, @y - 1, 2)
 
 -           move_straight(8)
 
 -         elsif passable?(@x, @y, 6) && passable?(@x + 1, @y, 4)
 
 -           move_straight(6)
 
 -         else
 
 -           move_straight(Input.dir4) if Input.dir4 > 0
 
 -         end
 
 -       elsif @direction == 8
 
 -         if passable?(@x, @y, 6) && passable?(@x + 1, @y, 4)
 
 -           move_straight(6)
 
 -         elsif passable?(@x, @y, 8) && passable?(@x, @y - 1, 2)
 
 -           move_straight(8)
 
 -         else
 
 -           move_straight(Input.dir4) if Input.dir4 > 0
 
 -         end
 
 -       else
 
 -         move_straight(Input.dir4) if Input.dir4 > 0
 
 -       end
 
 -     else
 
 -       move_straight(Input.dir4) if Input.dir4 > 0
 
 -     end
 
 -     unless moving?
 
 -       @direction = Input.dir4 unless Input.dir4 == 0
 
 -     end
 
 -   end
 
 - end
 
  复制代码 |   
 
 
 
 |