幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3075|回复: 17

[RMVX] [求助] 还是斜着走的问题

[复制链接]

550

主题

9117

帖子

214748万

积分

超级版主

如同神一般的存在,腿神!拖后腿的神~~

Rank: 8Rank: 8

积分
2147483647
发表于 2007-3-29 16:01:44 | 显示全部楼层 |阅读模式
是这样,,不只是斜45度走,,就是默认的那个行走图,,怎么实现斜着走,且不知是斜45度的行走 [s:8]
我就是你们的神,庶民们,追随我吧!跟着我一起拖后腿!
回复

使用道具 举报

93

主题

1801

帖子

7万

积分

荣誉群

被神隐藏的兔子

积分
79512

声命组银赏地图奨金赏

QQ
发表于 2007-3-29 16:23:24 | 显示全部楼层
脚本……我不知道= =|||
事件……设置角色移动……有斜着走的那个什么向X上~~向X下移动就是
RMVX,我等待着你! VX唯一的弱点,速度太慢~其他都好解决~~
回复 支持 反对

使用道具 举报

134

主题

2120

帖子

214748万

积分

⑥精研

ご覧の通り 、僕は妄

积分
2147483647
QQ
发表于 2007-3-29 18:11:45 | 显示全部楼层
啊啊~~~好象有脚本的
回复 支持 反对

使用道具 举报

550

主题

9117

帖子

214748万

积分

超级版主

如同神一般的存在,腿神!拖后腿的神~~

Rank: 8Rank: 8

积分
2147483647
 楼主| 发表于 2007-3-29 21:57:31 | 显示全部楼层
非45度的,,,有吗?我都没有找到过阿…………在哪啊? [s:6]
我就是你们的神,庶民们,追随我吧!跟着我一起拖后腿!
回复 支持 反对

使用道具 举报

134

主题

2120

帖子

214748万

积分

⑥精研

ご覧の通り 、僕は妄

积分
2147483647
QQ
发表于 2007-3-29 23:05:31 | 显示全部楼层
以前我还用过来着,好象叫《伪·八方走》
回复 支持 反对

使用道具 举报

550

主题

9117

帖子

214748万

积分

超级版主

如同神一般的存在,腿神!拖后腿的神~~

Rank: 8Rank: 8

积分
2147483647
 楼主| 发表于 2007-3-30 08:11:38 | 显示全部楼层
有名字就好办了 [s:2]

说的是这个不?。怎么有(有溜冰的感觉)
ctrl+shift+f搜索脚本“dir4”
找到如下内容:
      case Input.dir4
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      end
改为如下内容:
      case Input.dir8
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      when 1
        move_lower_left
      when 3
        move_lower_right
      when 7  
        move_upper_left
      when 9
        move_upper_right
      end
就直接变成伪八方向走了。此修改方法支持绝大多数脚本,包括人物跟随原版.


个人认为这个更好 [s:5]

#脚本功能:伪•八方向走
#使用方法:Main前面新建一个脚本,全选后粘贴进去
#效果:角色可以向八个方向走,不过会有溜冰的感觉。此外由于未经过debug,可能会有一些小错误,请感兴趣的朋友使用。

# ドット単位移動人柱バージョン

#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
#  プレイヤーを扱うクラスです。イベントの起動判定や、マップのスクロールなどの
# 機能を持っています。このクラスのインスタンスは $game_player で参照されます。
#==============================================================================

class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :revise_x           # X座標補正値
attr_accessor :revise_y           # Y座標補正値
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
  @revise_x = 0
  @revise_y = 0
  super
end
def moving?
  if @move_route_forcing
    super
  else
    return (@x != (@real_x / 128.0).round or @y != (@real_y / 128.0).round)
  end
end
#--------------------------------------------------------------------------
# ● 下に移動
#--------------------------------------------------------------------------
def move_down_p
  # 下を向く
  turn_down
  # 下に移動
  distance = 2 ** @move_speed
  down1(@x, @y, distance)
end
def down1(x, y, distance)
  return false unless down2(x, y, distance)
  if @revise_x < -32
    return false unless down2(x - 1, y, distance)
  elsif @revise_x > 32
    return false unless down2(x + 1, y, distance)
  end
  @revise_y += distance
  return true
end
def down2(x, y, distance)
  if @revise_y + distance > 0
    unless passable?(x, y, 2)
    @revise_y = 0
    @event = check_event_trigger_touch(x, y+1)
    return false
    end
  end
  return true
end
#--------------------------------------------------------------------------
# ● 左に移動
#--------------------------------------------------------------------------
def move_left_p
  # 左を向く
  turn_left
  distance = 2 ** @move_speed
  left1(@x, @y, distance)
end
def left1(x, y, distance)
  return false unless left2(x, y, distance)
  if @revise_y < -48
    return false unless left2(x, y - 1, distance)
  elsif @revise_y > 0
    return false unless left2(x, y + 1, distance)
  end
  @revise_x -= distance
  return true
end
def left2(x, y, distance)
  if @revise_x - distance < -32
    unless passable?(x, y, 4)
    @revise_x = -32
    @event = check_event_trigger_touch(x-1, y)
    return false
    end
  end
  return true
end
#--------------------------------------------------------------------------
# ● 右に移動
#--------------------------------------------------------------------------
def move_right_p
    # 右を向く
    turn_right
  distance = 2 ** @move_speed
  right1(@x, @y, distance)
end
def right1(x, y, distance)
  return false unless right2(x, y, distance)
  if @revise_y < -48
    return false unless right2(x, y, distance)
  elsif @revise_y > 0
    return false unless right2(x, y + 1, distance)
  end
  @revise_x += distance
  return true
end
def right2(x, y, distance)
  if @revise_x + distance > 32
    unless passable?(x, y, 6)
    @revise_x = 32
    @event = check_event_trigger_touch(x+1, y)
    return false
    end
  end
  return true
end
#--------------------------------------------------------------------------
# ● 上に移動
#--------------------------------------------------------------------------
def move_up_p
  # 上を向く
  turn_up
  # 下に移動
  distance = 2 ** @move_speed
  up1(@x, @y, distance)
end
def up1(x, y, distance)
  return false unless up2(x, y, distance)
  if @revise_x < -32
    return false unless up2(x - 1, y, distance)
  elsif @revise_x > 32
    return false unless up2(x + 1, y, distance)
  end
  @revise_y -= distance
  return true
end
def up2(x, y, distance)
  if @revise_y - distance < -48
    unless passable?(x, y, 8)
    @revise_y = -48
    @event = check_event_trigger_touch(x, y-1)
    return false
    end
  end
  return true
end
#--------------------------------------------------------------------------
# ● 左下に移動
#--------------------------------------------------------------------------
def move_lower_left_p
  # 向き固定でない場合
  unless @direction_fix
    # 右向きだった場合は左を、上向きだった場合は下を向く
    @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  end
  # 左下に移動
  distance = (2 ** @move_speed) / Math.sqrt(2)
  turn_left unless down1(@x, @y, distance)
  turn_down if @event
  turn_down unless left1(@x, @y, distance) unless @event
  turn_left if @event
end
#--------------------------------------------------------------------------
# ● 右下に移動
#--------------------------------------------------------------------------
def move_lower_right_p
  # 向き固定でない場合
  unless @direction_fix
    # 左向きだった場合は右を、上向きだった場合は下を向く
    @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  end
  # 右下に移動
  distance = (2 ** @move_speed) / Math.sqrt(2)
  turn_right unless down1(@x, @y, distance)
  turn_down if @event
  turn_down unless right1(@x, @y, distance) unless @event
  turn_right if @event
end
#--------------------------------------------------------------------------
# ● 左上に移動
#--------------------------------------------------------------------------
def move_upper_left_p
  # 向き固定でない場合
  unless @direction_fix
    # 右向きだった場合は左を、下向きだった場合は上を向く
    @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  end
  # 左下に移動
  distance = (2 ** @move_speed) / Math.sqrt(2)
  turn_left unless up1(@x, @y, distance)
  turn_up if @event
  turn_up unless left1(@x, @y, distance) unless @event
  turn_left if @event
end
#--------------------------------------------------------------------------
# ● 右上に移動
#--------------------------------------------------------------------------
def move_upper_right_p
  # 向き固定でない場合
  unless @direction_fix
    # 左向きだった場合は右を、下向きだった場合は上を向く
    @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  end
  # 右下に移動
  distance = (2 ** @move_speed) / Math.sqrt(2)
  turn_right unless up1(@x, @y, distance)
  turn_up if @event
  turn_up unless right1(@x, @y, distance) unless @event
  turn_right if @event
end
#--------------------------------------------------------------------------
# ● 座標修正
#--------------------------------------------------------------------------
def move_on
  if @y < (@real_y / 128.0).round
    @y += 1
    @revise_y -= 128
    increase_steps
  end
  if @x > (@real_x / 128.0).round
    @x -= 1
    @revise_x += 128
    increase_steps
  end
  if @x < (@real_x / 128.0).round
    @x += 1
    @revise_x -= 128
    increase_steps
  end
  if @y > (@real_y / 128.0).round
    @y -= 1
    @revise_y += 128
    increase_steps
  end
end
#--------------------------------------------------------------------------
# ● アニメーションアップデート
#--------------------------------------------------------------------------
def anime_update
  # 移動時アニメが ON の場合
  if @walk_anime
    # アニメカウントを 1.5 増やす
    @anime_count += 1.5
  # 移動時アニメが OFF で、停止時アニメが ON の場合
  elsif @step_anime
    # アニメカウントを 1 増やす
    @anime_count += 1
  end
  # アニメカウントが最大値を超えた場合
  # ※最大値は、基本値 18 から移動速度 * 1 を引いた値
  if @anime_count > 18 - @move_speed * 2
    # 停止時アニメが OFF かつ 停止中の場合
    if not @step_anime and @stop_count > 0
    # パターンをオリジナルに戻す
    @pattern = @original_pattern
    # 停止時アニメが ON または 移動中の場合
    else
    # パターンを更新
    @pattern = (@pattern + 1) % 4
    end
    # アニメカウントをクリア
    @anime_count = 0
  end
end
#--------------------------------------------------------------------------
# ● 正面のイベント起動判定
#--------------------------------------------------------------------------
# オリジナルのイベントを改名
alias :check_event_trigger_there_original :check_event_trigger_there
def check_event_trigger_there(triggers)
  result = check_event_trigger_there_original(triggers)
  unless result
    if @direction == 2 or @direction == 8
    if @revise_x < -32
      @x -= 1
      result = check_event_trigger_there_original(triggers)
      @x += 1
    elsif @revise_x > 32
      @x += 1
      result = check_event_trigger_there_original(triggers)
      @x -= 1
    end
    elsif @direction == 4 or @direction == 6
    if @revise_y < -48
      @y -= 1
      result = check_event_trigger_there_original(triggers)
      @y += 1
    elsif @revise_y > 0
      @y += 1
      result = check_event_trigger_there_original(triggers)
      @y -= 1
    end
    end
  end
  return result
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
  if @revise_x == nil and @revise_y == nil
    @revise_x = 0
    @revise_y = 0
  end
  if @move_route_forcing
    # ローカル変数に移動中かどうかを記憶
    last_moving = moving?
    # ローカル変数に座標を記憶
    last_real_x = @real_x
    last_real_y = @real_y
    # 座標がずれている場合
    if @revise_x != 0 or @revise_y != 0
    distance1 = 2 ** @move_speed
    distance2= Math.sqrt(@revise_x ** 2 + @revise_y ** 2)
    if distance1 > distance2
      @real_x = (@real_x - @revise_x).round
      @real_y = (@real_y - @revise_y).round
      @revise_x = 0
      @revise_y = 0
      anime_update
    else
      @revise_x -= distance1 * @revise_x / distance2
      @revise_y -= distance1 * @revise_y / distance2
      # 移動処理
      @real_x -= distance1 * @revise_x / distance2
      @real_y -= distance1 * @revise_y / distance2
      anime_update
    end
    else
    super
    end
  else
    # 移動中、イベント実行中、移動ルート強制中、
    # メッセージウィンドウ表示中のいずれでもない場合
    unless moving? or $game_system.map_interpreter.running? or
        @move_route_forcing or $game_temp.message_window_showing
    #ダッシュ機能。エンターキーが押されている間、移動速度を変更する。
    if Input.press?(Input::C)
      if @move_speed != 5
        @move_speed = 5
      end
    else
      if @move_speed != 4
        @move_speed = 4
      end
    end
    @event = false
    # 方向ボタンが押されていれば、その方向へプレイヤーを移動
    case Input.dir8
    when 1
      move_lower_left_p
    when 2
      move_down_p
    when 3
      move_lower_right_p
    when 4
      move_left_p
    when 6
      move_right_p
    when 7
      move_upper_left_p
    when 8
      move_up_p
    when 9
      move_upper_right_p
    end
    end
    # ローカル変数に座標を記憶
    last_real_x = @real_x
    last_real_y = @real_y
    # 移動処理
    @real_x = @x * 128 + @revise_x
    @real_y = @y * 128 + @revise_y
    # ローカル変数に移動中かどうかを記憶
    last_moving = moving?
    move_on
    if (last_real_x != @real_x or last_real_y != @real_y)
    anime_update
    else
    @pattern = 0
    end
  end
  # キャラクターが下に移動し、かつ画面上の位置が中央より下の場合
  if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
    # マップを下にスクロール
    $game_map.scroll_down(@real_y - last_real_y)
  end
  # キャラクターが左に移動し、かつ画面上の位置が中央より左の場合
  if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
    # マップを左にスクロール
    $game_map.scroll_left(last_real_x - @real_x)
  end
  # キャラクターが右に移動し、かつ画面上の位置が中央より右の場合
  if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
    # マップを右にスクロール
    $game_map.scroll_right(@real_x - last_real_x)
  end
  # キャラクターが上に移動し、かつ画面上の位置が中央より上の場合
  if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
    # マップを上にスクロール
    $game_map.scroll_up(last_real_y - @real_y)
  end
  # 移動中ではない場合
  unless moving?
    # 前回プレイヤーが移動中だった場合
    if last_moving
    # 同位置のイベントとの接触によるイベント起動判定
    result = check_event_trigger_here([1,2])
    # 起動したイベントがない場合
    if result == false
      # デバッグモードが ON かつ CTRL キーが押されている場合を除き
      unless $DEBUG and Input.press?(Input::CTRL)
        # エンカウント カウントダウン
        if @encounter_count > 0
        @encounter_count -= 1
        end
      end
    end
    end
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
    # 同位置および正面のイベント起動判定
    check_event_trigger_here([0])
    check_event_trigger_there([0,1,2])
    end
  end
end
end


郑重声明:以上均为本人剽窃而来………………  [s:7]
我就是你们的神,庶民们,追随我吧!跟着我一起拖后腿!
回复 支持 反对

使用道具 举报

550

主题

9117

帖子

214748万

积分

超级版主

如同神一般的存在,腿神!拖后腿的神~~

Rank: 8Rank: 8

积分
2147483647
 楼主| 发表于 2007-3-30 08:18:42 | 显示全部楼层
我说的更明确一点好了,,要事件这么走,,更重要的是不要45度的,,,不要45度的。。。。。。。。角度要任意。。。这样就明确了吧……………… [s:6]
我就是你们的神,庶民们,追随我吧!跟着我一起拖后腿!
回复 支持 反对

使用道具 举报

90

主题

785

帖子

1278万

积分

版主

Rank: 7Rank: 7Rank: 7

积分
12786515
QQ
发表于 2007-3-30 21:08:20 | 显示全部楼层
那样LZ想16方向还是32方向呢? [s:5]
回复 支持 反对

使用道具 举报

255

主题

7092

帖子

330

积分

版主

人类总是重复同样的悲

Rank: 7Rank: 7Rank: 7

积分
330
QQ
发表于 2007-3-30 23:09:15 | 显示全部楼层
引用第7楼form-ei2007-03-30 21:08发表的:
那样LZ想16方向还是32方向呢? [s:5]
全方向 [s:5] 哪个游戏有全方向
我是化可能为不可能的男人!
回复 支持 反对

使用道具 举报

550

主题

9117

帖子

214748万

积分

超级版主

如同神一般的存在,腿神!拖后腿的神~~

Rank: 8Rank: 8

积分
2147483647
 楼主| 发表于 2007-3-31 07:53:03 | 显示全部楼层
就是全方向………………严重伤害了我幼小的心灵……………… [s:6]
我就是你们的神,庶民们,追随我吧!跟着我一起拖后腿!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2025-6-24 05:19 , Processed in 0.020357 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表