设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1225|回复: 3
打印 上一主题 下一主题

[已经解决] Game map里的Game vehicle脚本出错怎么解决

[复制链接]

Lv1.梦旅人

梦石
0
星屑
88
在线时间
1906 小时
注册时间
2012-10-5
帖子
1991

开拓者

跳转到指定楼层
1
发表于 2012-10-13 05:06:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我在添加交通工具的时后把game map改了.现在怎么解决GAME VEHICLE出错的问题?RT
     
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  這個類用來操控地圖,包含了地圖滾動設置和通行度判定等資訊。
#  這個類的實例被全域變數 $game_map 所引用。
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * 宣告執行個體變數
  #--------------------------------------------------------------------------
  attr_reader   :screen                   # 地圖畫面狀態
  attr_reader   :interpreter              # 地圖事件直譯器
  attr_reader   :display_x                # 地圖畫面顯示X座標 * 256
  attr_reader   :display_y                # 地圖畫面顯示Y座標 * 256
  attr_reader   :parallax_name            # 遠景圖檔名
  attr_reader   :passages                 # 通行度設定表
  attr_reader   :events                   # 事件
  attr_reader   :vehicles                 # 交通工具
  attr_accessor :need_refresh             # 更新內容資訊需求標幟
  attr_accessor :map                      # 用於辨識地圖的標幟
  #--------------------------------------------------------------------------
  # * 物件初始化
  #--------------------------------------------------------------------------
  def initialize
    @screen = Game_Screen.new
    @interpreter = Game_Interpreter.new(0, true)
    @map_id = 0
    @display_x = 0
    @display_y = 0
    create_vehicles
  end
  #--------------------------------------------------------------------------
  # * 設置
  #     map_id : 地圖編號
  #--------------------------------------------------------------------------
  def setup(map_id)
    @map_id = map_id
    @map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
    @display_x = 10
    @display_y = 20
    @passages = $data_system.passages
    referesh_vehicles
    setup_events
    setup_scroll
    setup_parallax
    @need_refresh = false
  end
  #--------------------------------------------------------------------------
  # * 創建交通工具
  #--------------------------------------------------------------------------
  def create_vehicles
    @vehicles = []
    @vehicles[0] = Game_Vehicle.new(0)    # 舟
    @vehicles[1] = Game_Vehicle.new(1)    # 船
    @vehicles[2] = Game_Vehicle.new(2)    # 飞挺
    @vehicles[3] = Game_Vehicle.new(3)    # 坦克
    @vehicles[4] = Game_Vehicle.new(4)    # 马
    @vehicles[5] = Game_Vehicle.new(5)    # 大船
    @vehicles[6] = Game_Vehicle.new(6)    # 毛毯
  end
  #--------------------------------------------------------------------------
  # * 更新交通工具內容資訊
  #--------------------------------------------------------------------------
  def referesh_vehicles
    for vehicle in @vehicles
      vehicle.refresh
    end
  end
  #--------------------------------------------------------------------------
  # * 登上舟
  #--------------------------------------------------------------------------
  def boat
    return @vehicles[0]
  end
  #--------------------------------------------------------------------------
  # * 登上船
  #--------------------------------------------------------------------------
  def ship
    return @vehicles[1]
  end
  #--------------------------------------------------------------------------
  # * 登上空艇
  #--------------------------------------------------------------------------
  def airship
    return @vehicles[2]
  end
  #--------------------------------------------------------------------------
  # * 登上坦克
  #--------------------------------------------------------------------------
  def tank
    return @vehicles[3]
  end
  #--------------------------------------------------------------------------
  # * 登上马
  #--------------------------------------------------------------------------
  def horse
    return @vehicles[4]
  end
  #--------------------------------------------------------------------------
  # * 登上大船
  #--------------------------------------------------------------------------
  def bigship
    return @vehicles[5]
  end
  
  #--------------------------------------------------------------------------
  # * 登上毛毯
  #--------------------------------------------------------------------------
  def carpet
    return @vehicles[6]
  end
  #--------------------------------------------------------------------------
  # * 事件設置
  #--------------------------------------------------------------------------
  def setup_events
    @events = {}          # 地圖事件
    for i in @map.events.keys
      @events[i] = Game_Event.new(@map_id, @map.events[i])
    end
    @common_events = {}   # 全域事件
    for i in 1...$data_common_events.size
      @common_events[i] = Game_CommonEvent.new(i)
    end
  end
  #--------------------------------------------------------------------------
  # * 滾動設置
  #--------------------------------------------------------------------------
  def setup_scroll
    @scroll_direction = 2
    @scroll_rest = 0
    @scroll_speed = 4
    @margin_x = (width - 17) * 256 / 2      # 畫面未顯示的部分的寬度 /2
    @margin_y = (height - 13) * 256 / 2     # 畫面未顯示的部分的高度 /2
  end
  #--------------------------------------------------------------------------
  # * 遠景設置
  #--------------------------------------------------------------------------
  def setup_parallax
    @parallax_name = @map.parallax_name
    @parallax_loop_x = @map.parallax_loop_x
    @parallax_loop_y = @map.parallax_loop_y
    @parallax_sx = @map.parallax_sx
    @parallax_sy = @map.parallax_sy
    @parallax_x = 0
    @parallax_y = 0
  end
  #--------------------------------------------------------------------------
  # * 設置顯示位置
  #     x : 地圖畫面顯示X座標 (*256)
  #     y : 地圖畫面顯示Y座標 (*256)
  #--------------------------------------------------------------------------
  def set_display_pos(x, y)
    @display_x = (x + @map.width * 256) % (@map.width * 256)
    @display_y = (y + @map.height * 256) % (@map.height * 256)
    @parallax_x = x
    @parallax_y = y
  end
  #--------------------------------------------------------------------------
  # * 計算遠景圖顯示的X座標
  #     bitmap : 遠景圖
  #--------------------------------------------------------------------------
  def calc_parallax_x(bitmap)
    if bitmap == nil
      return 0
    elsif @parallax_loop_x
      return @parallax_x / 16
    elsif loop_horizontal?
      return 0
    else
      w1 = bitmap.width - 544
      w2 = @map.width * 32 - 544
      if w1 <= 0 or w2 <= 0
        return 0
      else
        return @parallax_x * w1 / w2 / 8
      end
    end
  end
  #--------------------------------------------------------------------------
  # * 計算遠景圖顯示的Y座標
  #     bitmap : 遠景圖
  #--------------------------------------------------------------------------
  def calc_parallax_y(bitmap)
    if bitmap == nil
      return 0
    elsif @parallax_loop_y
      return @parallax_y / 16
    elsif loop_vertical?
      return 0
    else
      h1 = bitmap.height - 416
      h2 = @map.height * 32 - 416
      if h1 <= 0 or h2 <= 0
        return 0
      else
        return @parallax_y * h1 / h2 / 8
      end
    end
  end
  #--------------------------------------------------------------------------
  # * 獲取地圖編號資訊
  #--------------------------------------------------------------------------
  def map_id
    return @map_id
  end
  #--------------------------------------------------------------------------
  # * 獲取地圖寬度資訊
  #--------------------------------------------------------------------------
  def width
    return @map.width
  end
  #--------------------------------------------------------------------------
  # * 獲取地圖高度資訊
  #--------------------------------------------------------------------------
  def height
    return @map.height
  end
  #--------------------------------------------------------------------------
  # * 橫向滾動地圖?
  #--------------------------------------------------------------------------
  def loop_horizontal?
    return (@map.scroll_type == 2 or @map.scroll_type == 3)
  end
  #--------------------------------------------------------------------------
  # * 縱向滾動地圖?
  #--------------------------------------------------------------------------
  def loop_vertical?
    return (@map.scroll_type == 1 or @map.scroll_type == 3)
  end
  #--------------------------------------------------------------------------
  # * 獲取地圖是否禁用奔跑的資訊
  #--------------------------------------------------------------------------
  def disable_dash?
    return @map.disable_dashing
  end
  #--------------------------------------------------------------------------
  # * 獲取地雷遇敵隊伍列表資訊
  #--------------------------------------------------------------------------
  def encounter_list
    return @map.encounter_list
  end
  #--------------------------------------------------------------------------
  # * 獲取地雷遇敵剩餘步數資訊
  #--------------------------------------------------------------------------
  def encounter_step
    return @map.encounter_step
  end
  #--------------------------------------------------------------------------
  # * 獲取地圖資料
  #--------------------------------------------------------------------------
  def data
    return @map.data
  end
  #--------------------------------------------------------------------------
  # * 計算X座標並減去地圖畫面顯示座標
  #     x : X座標
  #--------------------------------------------------------------------------
  def adjust_x(x)
    if loop_horizontal? and x < @display_x - @margin_x
      return x - @display_x + @map.width * 256
    else
      return x - @display_x
    end
  end
  #--------------------------------------------------------------------------
  # * 計算y座標並減去地圖畫面顯示座標
  #     y : Y座標
  #--------------------------------------------------------------------------
  def adjust_y(y)
    if loop_vertical? and y < @display_y - @margin_y
      return y - @display_y + @map.height * 256
    else
      return y - @display_y
    end
  end
  #--------------------------------------------------------------------------
  # * 計算迴圈調校後的X座標
  #     x : X座標
  #--------------------------------------------------------------------------
  def round_x(x)
    if loop_horizontal?
      return (x + width) % width
    else
      return x
    end
  end
  #--------------------------------------------------------------------------
  # * 計算迴圈調校後的Y座標
  #     y : Y座標
  #--------------------------------------------------------------------------
  def round_y(y)
    if loop_vertical?
      return (y + height) % height
    else
      return y
    end
  end
  #--------------------------------------------------------------------------
  # * 計算指定方向的一格的X座標
  #     x         : X座標
  #     direction : 方向(下,左,右,上) (2,4,6,8)
  #--------------------------------------------------------------------------
  def x_with_direction(x, direction)
    return round_x(x + (direction == 6 ? 1 : direction == 4 ? -1 : 0))
  end
  #--------------------------------------------------------------------------
  # * 計算指定方向的一格的Y座標
  #     y         : Y座標
  #     direction : 方向(下,左,右,上) (2,4,6,8)
  #--------------------------------------------------------------------------
  def y_with_direction(y, direction)
    return round_y(y + (direction == 2 ? 1 : direction == 8 ? -1 : 0))
  end
  #--------------------------------------------------------------------------
  # * 獲取指定座標所在的事件陣列資訊
  #     x : X座標
  #     y : Y座標
  #--------------------------------------------------------------------------
  def events_xy(x, y)
    result = []
    for event in $game_map.events.values
      result.push(event) if event.pos?(x, y)
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * 自動切換BGM/BGS
  #--------------------------------------------------------------------------
  def autoplay
    @map.bgm.play if @map.autoplay_bgm unless $game_player.in_vehicle?
    @map.bgs.play if @map.autoplay_bgs
  end
  #--------------------------------------------------------------------------
  # * 更新內容資訊
  #--------------------------------------------------------------------------
  def refresh
    if @map_id > 0
      for event in @events.values
        event.refresh
      end
      for common_event in @common_events.values
        common_event.refresh
      end
    end
    @need_refresh = false
  end
  #--------------------------------------------------------------------------
  # * 向下滾動
  #     distance : 滾動距離
  #--------------------------------------------------------------------------
  def scroll_down(distance)
    if loop_vertical?
      @display_y += distance
      @display_y %= @map.height * 256
      @parallax_y += distance
    else
      last_y = @display_y
      @display_y = [@display_y + distance, (height - 13) * 256].min
      @parallax_y += @display_y - last_y
    end
  end
  #--------------------------------------------------------------------------
  # * 向左滾動
  #     distance : 滾動距離
  #--------------------------------------------------------------------------
  def scroll_left(distance)
    if loop_horizontal?
      @display_x += @map.width * 256 - distance
      @display_x %= @map.width * 256
      @parallax_x -= distance
    else
      last_x = @display_x
      @display_x = [@display_x - distance, 0].max
      @parallax_x += @display_x - last_x
    end
  end
  #--------------------------------------------------------------------------
  # * 向右滾動
  #     distance : 滾動距離
  #--------------------------------------------------------------------------
  def scroll_right(distance)
    if loop_horizontal?
      @display_x += distance
      @display_x %= @map.width * 256
      @parallax_x += distance
    else
      last_x = @display_x
      @display_x = [@display_x + distance, (width - 17) * 256].min
      @parallax_x += @display_x - last_x
    end
  end
  #--------------------------------------------------------------------------
  # * 向上滾動
  #     distance : 滾動距離
  #--------------------------------------------------------------------------
  def scroll_up(distance)
    if loop_vertical?
      @display_y += @map.height * 256 - distance
      @display_y %= @map.height * 256
      @parallax_y -= distance
    else
      last_y = @display_y
      @display_y = [@display_y - distance, 0].max
      @parallax_y += @display_y - last_y
    end
  end
  #--------------------------------------------------------------------------
  # * 判定座標合法性
  #     x : X座標
  #     y : Y座標
  #--------------------------------------------------------------------------
  def valid?(x, y)
    return (x >= 0 and x < width and y >= 0 and y < height)
  end
  #--------------------------------------------------------------------------
  # * 判斷通行度
  #     x    : X座標
  #     y    : Y座標
  #     flag : 用於查詢的通行度標幟
  #            (預設0x01,只有在駕駛交通工具的時候才改變)
  #--------------------------------------------------------------------------
  def passable?(x, y, flag = 0x01)
    for event in events_xy(x, y)            # 匹配座標的事件
      next if event.tile_id == 0            # 該事件圖形為空
      next if event.priority_type > 0       # 未被設為[在普通事件下方]
      next if event.through                 # “事件可穿透”屬性
      pass = @passages[event.tile_id]       # 獲取通行度屬性資訊
      next if pass & 0x10 == 0x10           # [☆] : 不影響通行度
      return true if pass & flag == 0x00    # [○] : 可以通行
      return false if pass & flag == flag   # [×] : 不可以通行
    end
    for i in [2, 1, 0]                      # 為了按從上到下的地圖層次順序
      tile_id = @map.data[x, y, i]          # 獲取地圖元件編號資訊
      return false if tile_id == nil        # 獲取地圖元件資訊失敗:不可通行
      pass = @passages[tile_id]             # 獲取通行度屬性資訊
      next if pass & 0x10 == 0x10           # [☆] : 不影響通行度
      return true if pass & flag == 0x00    # [○] : 可以通行
      return false if pass & flag == flag   # [×] : 不可以通行
    end
    return false                            # 不可通行
  end
  #--------------------------------------------------------------------------
  # * 判斷舟航行通行度
  #     x    : X座標
  #     y    : Y座標
  #--------------------------------------------------------------------------
  def boat_land_ok?(x, y)
    return passable?(x, y, 0x02)
  end
  #--------------------------------------------------------------------------
  # * 判斷船航行通行度
  #     x    : X座標
  #     y    : Y座標
  #--------------------------------------------------------------------------
  def ship_land_ok?(x, y)
    return passable?(x, y, 0x04)
  end
  #--------------------------------------------------------------------------
  # * 判斷飛艇登陸通行度
  #     x    : X座標
  #     y    : Y座標
  #--------------------------------------------------------------------------
  def airship_land_ok?(x, y)
    return passable?(x, y, 0x08)
  end
  
  def tank_land_ok?(x, y)
     return passable?(x, y, 0x10)
  end
   
  def house_land_ok?( x, y)
    return passable?(x, y, 0x12)
  end
  
  def bigship_land_ok?( x, y)
    return passable?(x, y, 0x14)
  end
  
  def carpet_land_ok?( x, y)
    eturn passable?(x, y, 0x16)
  end
  #--------------------------------------------------------------------------
  # * 判斷草木茂密處的通行度
  #     x    : X座標
  #     y    : Y座標
  #--------------------------------------------------------------------------
  def bush?(x, y)
    return false unless valid?(x, y)
    return @passages[@map.data[x, y, 1]] & 0x40 == 0x40
  end
  #--------------------------------------------------------------------------
  # * 判斷具有櫃檯屬性的地圖元件
  #     x    : X座標
  #     y    : Y座標
  #--------------------------------------------------------------------------
  def counter?(x, y)
    return false unless valid?(x, y)
    return @passages[@map.data[x, y, 0]] & 0x80 == 0x80
  end
  #--------------------------------------------------------------------------
  # * 開始滾動地圖視域
  #     direction : 滾動方向
  #     distance  : 滾動距離
  #     speed     : 滾動速度
  #--------------------------------------------------------------------------
  def start_scroll(direction, distance, speed)
    @scroll_direction = direction
    @scroll_rest = distance * 256
    @scroll_speed = speed
  end
  #--------------------------------------------------------------------------
  # * 判定地圖視域是否正在滾動
  #--------------------------------------------------------------------------
  def scrolling?
    return @scroll_rest > 0
  end
  #--------------------------------------------------------------------------
  # * 更新幀
  #--------------------------------------------------------------------------
  def update
    refresh if $game_map.need_refresh
    update_scroll
    update_events
    update_vehicles
    update_parallax
    @screen.update
  end
  #--------------------------------------------------------------------------
  # * 更新地圖視域滾動資訊
  #--------------------------------------------------------------------------
  def update_scroll
    if @scroll_rest > 0                 # 滾動中?
      distance = 2 ** @scroll_speed     # 將轉速轉換為距離
      case @scroll_direction
      when 2  # 向下
        scroll_down(distance)
      when 4  # 向左
        scroll_left(distance)
      when 6  # 向右
        scroll_right(distance)
      when 8  # 向上
        scroll_up(distance)
      end
      @scroll_rest -= distance          # 減掉滾動過的距離
    end
  end
  #--------------------------------------------------------------------------
  # * 更新事件資訊
  #--------------------------------------------------------------------------
  def update_events
    for event in @events.values
      event.update
    end
    for common_event in @common_events.values
      common_event.update
    end
  end
  #--------------------------------------------------------------------------
  # * 更新交通工具資訊
  #--------------------------------------------------------------------------
  def update_vehicles
    for vehicle in @vehicles
      vehicle.update
    end
  end
  #--------------------------------------------------------------------------
  # * 更新遠景圖資訊
  #--------------------------------------------------------------------------
  def update_parallax
    @parallax_x += @parallax_sx * 4 if @parallax_loop_x
    @parallax_y += @parallax_sy * 4 if @parallax_loop_y
  end
end

#==============================================================================
# ** Game_Vehicle
#------------------------------------------------------------------------------
#  這個類用來操控交通工具,這個類作為 Game_Map 類的內部類使用。
#  如果當前地圖上沒有交通工具,則設置他們的地圖座標為(-1,-1)。
#==============================================================================

class Game_Vehicle < Game_Character
  #--------------------------------------------------------------------------
  # * 常數
  #--------------------------------------------------------------------------
  MAX_ALTITUDE = 0                      # 飛艇所在的高度
  #--------------------------------------------------------------------------
  # * 宣告執行個體變數
  #--------------------------------------------------------------------------
  attr_reader   :type                     # 交通工具類型(0..2)
  attr_reader   :altitude                 # 飛行高度(只針對飛艇)
  attr_reader   :driving                  # 判斷交通工具被控制的標幟
  #--------------------------------------------------------------------------
  # * 物件初始化
  #     type : 交通工具類型(0:舟,1:船,2:飛艇)
  #--------------------------------------------------------------------------
  def initialize(type)
    super()
    @type = type
    @altitude = 0
    @driving = false
    @direction = 4
    @walk_anime = false
    @step_anime = false
    load_system_settings
  end
  #--------------------------------------------------------------------------
  # * 載入系統交通工具參數設置
  #--------------------------------------------------------------------------
  def load_system_settings
    case @type
    when 0
      sys_vehicle = $data_system.boat
    when 1
      sys_vehicle = $data_system.ship
    when 2
      sys_vehicle = $data_system.airship
    when 3
      sys_vehicle = $data_system.tank
    when 4
      sys_vehicle = $data_system.horse
    when 5
      sys_vehicle = $data_system.bigship
    when 6
      sys_vehicle = $data_system.carpet
    else   
      sys_vehicle = true
    end
  #--------------------------------------------------------------------------
  # * 更新內容資訊
  #--------------------------------------------------------------------------
  def refresh
    if sys_vehicle = true
   @character_name = $sys_vehicle.character_name
   @character_index = $sys_vehicle.character_index
   @bgm = $sys_vehicle.bgm
end
    if @driving
   @map_id = $sys_vehicle.start_map_id
      sync_with_player
elsif @map_id == $sys_vehicle.start_map_id
      moveto(@x, @y)
    end
   @display_x = $sys_vehicle.start_x
   @display_y = $sys_vehicle.start_y
  end
end
    case @type
    when 0
      @priority_type = 1
      @move_speed = 4
    when 1
      @priority_type = 1
      @move_speed = 5
    when 2
      @priority_type = @driving ? 2 : 0
      @move_speed = 6
    when 3
      @priority_type = 1
      @move_speed = 7
    when 4
      @priority_type = 1
      @move_speed = 8
    when 5
      @priority_type = 1
      @move_speed = 9
    when 6
      @priority_type = 1
      @move_speed = 10
    @walk_anime = @driving
    @step_anime = @driving                  
  end

  #--------------------------------------------------------------------------
  # * 變更位置
  #     map_id : 地圖編號
  #     x      : 地圖X座標
  #     y      : 地圖Y座標
  #--------------------------------------------------------------------------
  def set_location(map_id, x, y)
    @map_id = map_id
    @x = x
    @y = y
    refresh
  end
  #--------------------------------------------------------------------------
  # * 判定座標是否匹配
  #     x : 地圖X座標
  #     y : 地圖Y座標
  #--------------------------------------------------------------------------
  def pos?(x, y)
    return (@map_id == $game_map.map_id and super(x, y))
  end
  #--------------------------------------------------------------------------
  # * 判定交通工具顯示透明度
  #--------------------------------------------------------------------------
  def transparent
    return (@map_id != $game_map.map_id or super)
  end
  #--------------------------------------------------------------------------
  # * 登上交通工具
  #--------------------------------------------------------------------------
  def get_on
    @driving = true
    @walk_anime = true
    @step_anime = true
    if @type == 0               # 舟
    @priority_type = 1  
    @bgm.play
  end
    if @type == 1               # 船
    @priority_type = 1  
    @bgm.play
  end
    if @type == 2               # 空艇?
    @priority_type = 2        # 更改顯示優先順序為[在普通人物上方]
    @bgm.play
  end
    if @type == 3               # 坦克
    @priority_type = 1
    @bgm.play
  end
    if @type == 4               # 马
    @priority_type = 1
    @bgm.play
  end
    if @type == 5               # 大船
    @priority_type = 1
    @bgm.play
  end
    if @type == 6               # 毛毯
    @priority_type = 2
    @bgm.play                   # 播放交通工具專屬BGM
  end
  #--------------------------------------------------------------------------
  # * 登下交通工具
  #--------------------------------------------------------------------------
  def get_off
    @driving = false
    @walk_anime = false
    @step_anime = false
    @direction = 4
  end
  #--------------------------------------------------------------------------
  # * 與玩家主角座標同步移動
  #--------------------------------------------------------------------------
  def sync_with_player
    @x = $game_player.x
    @y = $game_player.y
    @real_x = $game_player.real_x
    @real_y = $game_player.real_y
    @direction = $game_player.direction
    update_bush_depth
  end
  #--------------------------------------------------------------------------
  # * 獲取行駛速度
  #--------------------------------------------------------------------------
  def speed
    return @move_speed
  end
  #--------------------------------------------------------------------------
  # * 獲取螢幕Y座標差量
  #--------------------------------------------------------------------------
  def screen_y
    return super - altitude
  end
  #--------------------------------------------------------------------------
  # * 通行度判定
  #--------------------------------------------------------------------------
  def movable?
    return false if
    (@type == 0 and @altitude < MAX_ALTITUDE)
    (@type == 1 and @altitude < MAX_ALTITUDE)
    (@type == 2 and @altitude < MAX_ALTITUDE)
    (@type == 3 and @altitude < MAX_ALTITUDE)
    (@type == 4 and @altitude < MAX_ALTITUDE)
    (@type == 5 and @altitude < MAX_ALTITUDE)
    (@type == 6 and @altitude < MAX_ALTITUDE)
    return (not moving?)
  end
  #--------------------------------------------------------------------------
  # * 更新幀
  #--------------------------------------------------------------------------
def update
  super
    if @type == 2               # 空艇?
      if @driving
        if @altitude < MAX_ALTITUDE
          @altitude += 1         # 高度增加
        end        
    elsif @altitude > 0
          @altitude -= 1          # 高度降低
       if @altitude == 0
          @priority_type = 0    # 恢復顯示優先順序為[在普通人物下方]
        end
        
       if @type == 6               # 毛毯
        if @driving
        if @altitude < MAX_ALTITUDE
          @altitude += 1      
        end
     elsif @altitude > 0
          @altitude -= 1          # 高度降低
       if @altitude == 0
          @priority_type = 0   
        end
      end
    end   

点评

等待LZ上范例,并澄清改动了哪里  发表于 2012-10-14 14:44
上传原范例以及说清楚你改动了哪里。  发表于 2012-10-13 12:16

Lv1.梦旅人

梦石
0
星屑
88
在线时间
1906 小时
注册时间
2012-10-5
帖子
1991

开拓者

2
 楼主| 发表于 2012-10-15 02:43:54 | 只看该作者
我在添加交通工具时把game_map.  Game_Vehicle改了.运行游戏显示Game_Vehicle 235行syntaxError.

原本:【★←红字的地方为改动部分】
#==============================================================================     
# ** Game_Map
#------------------------------------------------------------------------------
#  这个类用来操控地图,包含了地图滚动设置和通行度判定等信息。
#  这个类的实例被全局变量 $game_map 所引用。
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * 声明实例变量
  #--------------------------------------------------------------------------
  attr_reader   :screen                   # 地图画面状态
  attr_reader   :interpreter              # 地图事件直译器
  attr_reader   :display_x                # 地图画面显示X坐标 * 256
  attr_reader   :display_y                # 地图画面显示Y坐标 * 256
  attr_reader   :parallax_name            # 远景图档名
  attr_reader   :passages                 # 通行度设定表
  attr_reader   :events                   # 事件
  attr_reader   :vehicles                 # 交通工具
  attr_accessor :need_refresh             # 更新内容信息需求标示
  attr_accessor :map                      # 用于辨识地图的标示
  #--------------------------------------------------------------------------
  # * 对象初始化
  #--------------------------------------------------------------------------
  def initialize
    @screen = Game_Screen.new
    @interpreter = Game_Interpreter.new(0, true)
    @map_id = 0
    @display_x = 0
    @display_y = 0
    create_vehicles
  end
  #--------------------------------------------------------------------------
  # * 设置
  #     map_id : 地图编号
  #--------------------------------------------------------------------------
  def setup(map_id)
    @map_id = map_id
    @map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
    @display_x = 0
    @display_y = 0
    @passages = $data_system.passages
    referesh_vehicles
    setup_events
    setup_scroll
    setup_parallax
    @need_refresh = false
  end
  #--------------------------------------------------------------------------
  # * 创建交通工具
  #--------------------------------------------------------------------------
                               【★←这里多填加了4个】
               ★【@vehicles[4] = Game_Vehicle.new(4)】    # 马
               ★【@vehicles[5] = Game_Vehicle.new(5)】   # 大船
               ★【@vehicles[6] = Game_Vehicle.new(6)】   # 毛毯
               ★【@vehicles[3] = Game_Vehicle.new(3)】   # 坦克

  #--------------------------------------------------------------------------
  def create_vehicles   
    @vehicles = []
    @vehicles[0] = Game_Vehicle.new(0)    # 舟
    @vehicles[1] = Game_Vehicle.new(1)    # 船
    @vehicles[2] = Game_Vehicle.new(2)    # 飞艇
  end
  #--------------------------------------------------------------------------
  # * 更新交通工具内容信息
  #--------------------------------------------------------------------------
  def referesh_vehicles
    for vehicle in @vehicles
      vehicle.refresh
    end
  end
  #--------------------------------------------------------------------------
                                 ★←这里也一样
                                               
  * 登上马               *登上坦克               *登上大船                 *登上毛毯

★【def horse】                ★【def tank 】           ★ 【def bigship 】            ★【def carpet】
  【return @vehicles[4] 】    【return @vehicles[3] 】    【 return @vehicles[5]】        【return @vehicles[6]】
【 end】                 【end】                    【end】                       【end】
  
  #--------------------------------------------------------------------------
  def boat * 登上舟
    return @vehicles[0]
  end
  #--------------------------------------------------------------------------
  # * 登上船
  #--------------------------------------------------------------------------
  def ship
    return @vehicles[1]
  end
  #--------------------------------------------------------------------------
  # * 登上空艇
  #--------------------------------------------------------------------------
  def airship
    return @vehicles[2]
  end
  #--------------------------------------------------------------------------
  # * 事件设置
  #--------------------------------------------------------------------------
  def setup_events
    @events = {}          # 地图事件
    for i in @map.events.keys
      @events = Game_Event.new(@map_id, @map.events)
    end
    @common_events = {}   # 全局事件
    for i in 1...$data_common_events.size
      @common_events = Game_CommonEvent.new(i)
    end
  end
  #--------------------------------------------------------------------------
  # * 滚动设置
  #--------------------------------------------------------------------------
  def setup_scroll
    @scroll_direction = 2
    @scroll_rest = 0
    @scroll_speed = 4
    @margin_x = (width - 17) * 256 / 2      # 画面未显示的部分的宽度 /2
    @margin_y = (height - 13) * 256 / 2     # 画面未显示的部分的高度 /2
  end
  #--------------------------------------------------------------------------
  # * 远景设置
  #--------------------------------------------------------------------------
  def setup_parallax
    @parallax_name = @map.parallax_name
    @parallax_loop_x = @map.parallax_loop_x
    @parallax_loop_y = @map.parallax_loop_y
    @parallax_sx = @map.parallax_sx
    @parallax_sy = @map.parallax_sy
    @parallax_x = 0
    @parallax_y = 0
  end
  #--------------------------------------------------------------------------
  # * 设置显示位置
  #     x : 地图画面显示X坐标 (*256)
  #     y : 地图画面显示Y坐标 (*256)
  #--------------------------------------------------------------------------
  def set_display_pos(x, y)
    @display_x = (x + @map.width * 256) % (@map.width * 256)
    @display_y = (y + @map.height * 256) % (@map.height * 256)
    @parallax_x = x
    @parallax_y = y
  end
  #--------------------------------------------------------------------------
  # * 计算远景图显示的X坐标
  #     bitmap : 远景图
  #--------------------------------------------------------------------------
  def calc_parallax_x(bitmap)
    if bitmap == nil
      return 0
    elsif @parallax_loop_x
      return @parallax_x / 16
    elsif loop_horizontal?
      return 0
    else
      w1 = bitmap.width - 544
      w2 = @map.width * 32 - 544
      if w1 <= 0 or w2 <= 0
        return 0
      else
        return @parallax_x * w1 / w2 / 8
      end
    end
  end
  #--------------------------------------------------------------------------
  # * 计算远景图显示的Y坐标
  #     bitmap : 远景图
  #--------------------------------------------------------------------------
  def calc_parallax_y(bitmap)
    if bitmap == nil
      return 0
    elsif @parallax_loop_y
      return @parallax_y / 16
    elsif loop_vertical?
      return 0
    else
      h1 = bitmap.height - 416
      h2 = @map.height * 32 - 416
      if h1 <= 0 or h2 <= 0
        return 0
      else
        return @parallax_y * h1 / h2 / 8
      end
    end
  end
  #--------------------------------------------------------------------------
  # * 获取地图编号信息
  #--------------------------------------------------------------------------
  def map_id
    return @map_id
  end
  #--------------------------------------------------------------------------
  # * 获取地图宽度信息
  #--------------------------------------------------------------------------
  def width
    return @map.width
  end
  #--------------------------------------------------------------------------
  # * 获取地图高度信息
  #--------------------------------------------------------------------------
  def height
    return @map.height
  end
  #--------------------------------------------------------------------------
  # * 横向滚动地图?
  #--------------------------------------------------------------------------
  def loop_horizontal?
    return (@map.scroll_type == 2 or @map.scroll_type == 3)
  end
  #--------------------------------------------------------------------------
  # * 纵向滚动地图?
  #--------------------------------------------------------------------------
  def loop_vertical?
    return (@map.scroll_type == 1 or @map.scroll_type == 3)
  end
  #--------------------------------------------------------------------------
  # * 获取地图是否禁用奔跑的信息
  #--------------------------------------------------------------------------
  def disable_dash?
    return @map.disable_dashing
  end
  #--------------------------------------------------------------------------
  # * 获取地雷遇敌队伍列表信息
  #--------------------------------------------------------------------------
  def encounter_list
    return @map.encounter_list
  end
  #--------------------------------------------------------------------------
  # * 获取地雷遇敌剩余步数信息
  #--------------------------------------------------------------------------
  def encounter_step
    return @map.encounter_step
  end
  #--------------------------------------------------------------------------
  # * 获取地图数据
  #--------------------------------------------------------------------------
  def data
    return @map.data
  end
  #--------------------------------------------------------------------------
  # * 计算X坐标并减去地图画面显示坐标
  #     x : X坐标
  #--------------------------------------------------------------------------
  def adjust_x(x)
    if loop_horizontal? and x < @display_x - @margin_x
      return x - @display_x + @map.width * 256
    else
      return x - @display_x
    end
  end
  #--------------------------------------------------------------------------
  # * 计算y坐标并减去地图画面显示坐标
  #     y : Y坐标
  #--------------------------------------------------------------------------
  def adjust_y(y)
    if loop_vertical? and y < @display_y - @margin_y
      return y - @display_y + @map.height * 256
    else
      return y - @display_y
    end
  end
  #--------------------------------------------------------------------------
  # * 计算循环调校后的X坐标
  #     x : X坐标
  #--------------------------------------------------------------------------
  def round_x(x)
    if loop_horizontal?
      return (x + width) % width
    else
      return x
    end
  end
  #--------------------------------------------------------------------------
  # * 计算循环调校后的Y坐标
  #     y : Y坐标
  #--------------------------------------------------------------------------
  def round_y(y)
    if loop_vertical?
      return (y + height) % height
    else
      return y
    end
  end
  #--------------------------------------------------------------------------
  # * 计算指定方向的一格的X坐标
  #     x         : X坐标
  #     direction : 方向(下,左,右,上) (2,4,6,8)
  #--------------------------------------------------------------------------
  def x_with_direction(x, direction)
    return round_x(x + (direction == 6 ? 1 : direction == 4 ? -1 : 0))
  end
  #--------------------------------------------------------------------------
  # * 计算指定方向的一格的Y坐标
  #     y         : Y坐标
  #     direction : 方向(下,左,右,上) (2,4,6,8)
  #--------------------------------------------------------------------------
  def y_with_direction(y, direction)
    return round_y(y + (direction == 2 ? 1 : direction == 8 ? -1 : 0))
  end
  #--------------------------------------------------------------------------
  # * 获取指定坐标所在的事件数组信息
  #     x : X坐标
  #     y : Y坐标
  #--------------------------------------------------------------------------
  def events_xy(x, y)
    result = []
    for event in $game_map.events.values
      result.push(event) if event.pos?(x, y)
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * 自动切换BGM/BGS
  #--------------------------------------------------------------------------
  def autoplay
    @map.bgm.play if @map.autoplay_bgm unless $game_player.in_vehicle?
    @map.bgs.play if @map.autoplay_bgs
  end
  #--------------------------------------------------------------------------
  # * 更新内容信息
  #--------------------------------------------------------------------------
  def refresh
    if @map_id > 0
      for event in @events.values
        event.refresh
      end
      for common_event in @common_events.values
        common_event.refresh
      end
    end
    @need_refresh = false
  end
  #--------------------------------------------------------------------------
  # * 向下滚动
  #     distance : 滚动距离
  #--------------------------------------------------------------------------
  def scroll_down(distance)
    if loop_vertical?
      @display_y += distance
      @display_y %= @map.height * 256
      @parallax_y += distance
    else
      last_y = @display_y
      @display_y = [@display_y + distance, (height - 13) * 256].min
      @parallax_y += @display_y - last_y
    end
  end
  #--------------------------------------------------------------------------
  # * 向左滚动
  #     distance : 滚动距离
  #--------------------------------------------------------------------------
  def scroll_left(distance)
    if loop_horizontal?
      @display_x += @map.width * 256 - distance
      @display_x %= @map.width * 256
      @parallax_x -= distance
    else
      last_x = @display_x
      @display_x = [@display_x - distance, 0].max
      @parallax_x += @display_x - last_x
    end
  end
  #--------------------------------------------------------------------------
  # * 向右滚动
  #     distance : 滚动距离
  #--------------------------------------------------------------------------
  def scroll_right(distance)
    if loop_horizontal?
      @display_x += distance
      @display_x %= @map.width * 256
      @parallax_x += distance
    else
      last_x = @display_x
      @display_x = [@display_x + distance, (width - 17) * 256].min
      @parallax_x += @display_x - last_x
    end
  end
  #--------------------------------------------------------------------------
  # * 向上滚动
  #     distance : 滚动距离
  #--------------------------------------------------------------------------
  def scroll_up(distance)
    if loop_vertical?
      @display_y += @map.height * 256 - distance
      @display_y %= @map.height * 256
      @parallax_y -= distance
    else
      last_y = @display_y
      @display_y = [@display_y - distance, 0].max
      @parallax_y += @display_y - last_y
    end
  end
  #--------------------------------------------------------------------------
  # * 判定坐标合法性
  #     x : X坐标
  #     y : Y坐标
  #--------------------------------------------------------------------------
  def valid?(x, y)
    return (x >= 0 and x < width and y >= 0 and y < height)
  end
  #--------------------------------------------------------------------------
  # * 判断通行度
  #     x    : X坐标
  #     y    : Y坐标
  #     flag : 用于查询的通行度标示
  #            (预设0x01,只有在驾驶交通工具的时候才改变)
  #--------------------------------------------------------------------------
  def passable?(x, y, flag = 0x01)
    for event in events_xy(x, y)            # 匹配坐标的事件
      next if event.tile_id == 0            # 该事件图形为空
      next if event.priority_type > 0       # 未被设为[在普通事件下方]
      next if event.through                 # “事件可穿透”属性
      pass = @passages[event.tile_id]       # 获取通行度属性信息
      next if pass & 0x10 == 0x10           # [☆] : 不影响通行度
      return true if pass & flag == 0x00    # [○] : 可以通行
      return false if pass & flag == flag   # [×] : 不可以通行
    end
    for i in [2, 1, 0]                      # 为了按从上到下的地图层次顺序
      tile_id = @map.data[x, y, i]          # 获取地图组件编号信息
      return false if tile_id == nil        # 获取地图组件信息失败:不可通行
      pass = @passages[tile_id]             # 获取通行度属性信息
      next if pass & 0x10 == 0x10           # [☆] : 不影响通行度
      return true if pass & flag == 0x00    # [○] : 可以通行
      return false if pass & flag == flag   # [×] : 不可以通行
    end
    return false                            # 不可通行
  end
  #--------------------------------------------------------------------------
                      ★←这里填加4种通行度

    #坦克                            #马                                                      
【def tank_passable?(x, y)】        【def horse_passable?(x, y)】      
【return passable?(x, y, 0x10)】     【return passable?(x, y, 0x12)】   
【end】                           【end】                                                   
  
    #大船                            #毛毯
【def horse_passable?(x, y)】       【def carpet_passable?(x, y)】
【return passable?(x, y, 0x14)】     【return passable?(x, y, 0x16)】
【end】                           【end】
  #--------------------------------------------------------------------------
    * 判断舟航行通行度
  def boat_passable?(x, y)
    return passable?(x, y, 0x02)
  end
  #--------------------------------------------------------------------------
  # * 判断船航行通行度
  #     x    : X坐标
  #     y    : Y坐标
  #--------------------------------------------------------------------------
  def ship_passable?(x, y)
    return passable?(x, y, 0x04)
  end
  #--------------------------------------------------------------------------
  # * 判断飞艇登陆通行度
  #     x    : X坐标
  #     y    : Y坐标
  #--------------------------------------------------------------------------
  def airship_land_ok?(x, y)
    return passable?(x, y, 0x08)
  end
  #--------------------------------------------------------------------------
  # * 判断草木茂密处的通行度
  #     x    : X坐标
  #     y    : Y坐标
  #--------------------------------------------------------------------------
  def bush?(x, y)
    return false unless valid?(x, y)
    return @passages[@map.data[x, y, 1]] & 0x40 == 0x40
  end
  #--------------------------------------------------------------------------
  # * 判断具有柜台属性的地图组件
  #     x    : X坐标
  #     y    : Y坐标
  #--------------------------------------------------------------------------
  def counter?(x, y)
    return false unless valid?(x, y)
    return @passages[@map.data[x, y, 0]] & 0x80 == 0x80
  end
  #--------------------------------------------------------------------------
  # * 开始滚动地图视域
  #     direction : 滚动方向
  #     distance  : 滚动距离
  #     speed     : 滚动速度
  #--------------------------------------------------------------------------
  def start_scroll(direction, distance, speed)
    @scroll_direction = direction
    @scroll_rest = distance * 256
    @scroll_speed = speed
  end
  #--------------------------------------------------------------------------
  # * 判定地图视域是否正在滚动
  #--------------------------------------------------------------------------
  def scrolling?
    return @scroll_rest > 0
  end
  #--------------------------------------------------------------------------
  # * 更新帧
  #--------------------------------------------------------------------------
  def update
    refresh if $game_map.need_refresh
    update_scroll
    update_events
    update_vehicles
    update_parallax
    @screen.update
  end
  #--------------------------------------------------------------------------
  # * 更新地图视域滚动信息
  #--------------------------------------------------------------------------
  def update_scroll
    if @scroll_rest > 0                 # 滚动中?
      distance = 2 ** @scroll_speed     # 将转速转换为距离
      case @scroll_direction
      when 2  # 向下
        scroll_down(distance)
      when 4  # 向左
        scroll_left(distance)
      when 6  # 向右
        scroll_right(distance)
      when 8  # 向上
        scroll_up(distance)
      end
      @scroll_rest -= distance          # 减掉滚动过的距离
    end
  end
  #--------------------------------------------------------------------------
  # * 更新事件信息
  #--------------------------------------------------------------------------
  def update_events
    for event in @events.values
      event.update
    end
    for common_event in @common_events.values
      common_event.update
    end
  end
  #--------------------------------------------------------------------------
  # * 更新交通工具信息
  #--------------------------------------------------------------------------
  def update_vehicles
    for vehicle in @vehicles
      vehicle.update
    end
  end
  #--------------------------------------------------------------------------
  # * 更新远景图信息
  #--------------------------------------------------------------------------
  def update_parallax
    @parallax_x += @parallax_sx * 4 if @parallax_loop_x
    @parallax_y += @parallax_sy * 4 if @parallax_loop_y
  end
end
#--------------------------------------------------------------------------

原本:【★←红字的地方为改动部分】
#==============================================================================
# ** Game_Vehicle
#------------------------------------------------------------------------------
#  这个类用来操控交通工具,这个类作为 Game_Map 类的内部类使用。
#  如果当前地图上没有交通工具,则设置他们的地图坐标为(-1,-1)。
#==============================================================================

class Game_Vehicle < Game_Character
  #--------------------------------------------------------------------------
  # * 常数
  #--------------------------------------------------------------------------
  MAX_ALTITUDE = 32                       # 飞艇所在的高度 【★←这里max_altitude=0】
  #--------------------------------------------------------------------------
  # * 声明实例变量
  #--------------------------------------------------------------------------
  attr_reader   :type                     # 交通工具类型(0..2)
  attr_reader   :altitude                 # 飞行高度(只针对飞艇)
  attr_reader   :driving                  # 判断交通工具被控制的标示
  #--------------------------------------------------------------------------
  # * 对象初始化
  #     type : 交通工具类型(0:舟,1:船,2:飞艇)
  #--------------------------------------------------------------------------
  def initialize(type)
    super()
    @type = type
    @altitude = 0
    @driving = false
    @direction = 4
    @walk_anime = false
    @step_anime = false
    load_system_settings
  end
  #--------------------------------------------------------------------------
  # * 加载系统交通工具参数设置        
  #--------------------------------------------------------------------------
                   【★←这里填加4种参数】

when 3                                                      when 5      
  【sys_vehicle = $data_system.tank】        【sys_vehicle = $data_system.bigship】
when 4                                                      when 6
  【sys_vehicle = $data_system.horse】       【sys_vehicle = $data_system.carpet】

  
  #--------------------------------------------------------------------------
  def load_system_settings
    case @type
    when 0
      sys_vehicle = $data_system.boat
    when 1
      sys_vehicle = $data_system.ship
    when 2
      sys_vehicle = $data_system.airship
    else
      sys_vehicle = nil
    end
    if sys_vehicle != nil         
      @character_name = sys_vehicle.character_name
      @character_index = sys_vehicle.character_index
      @bgm = sys_vehicle.bgm
      @map_id = sys_vehicle.start_map_id
      @x = sys_vehicle.start_x
      @y = sys_vehicle.start_y
    end
  end
  #--------------------------------------------------------------------------
  # * 更新内容信息              
  #--------------------------------------------------------------------------
                         ★←这里填加4种更新
  when 3                                        when 5
    【@priority_type = 1】                【@priority_type = 1】
    【@move_speed = 7】                 【@move_speed = 9】
                                                                     
  when 4                                          when 6
    【@priority_type = 1】              【@priority_type =1】
    【@move_speed = 8】                 【@move_speed = 10】

  #--------------------------------------------------------------------------
                         【★←这里填加4种】
   when 3                          when 4                              
【@priority_type = 1】    【@priority_type = 1】
【@move_speed = 7】    【@move_speed = 8】
     
    when 5                           when 6
【@priority_type = 1】    【@priority_type = @driving ? 2 : 0】
【@move_speed = 9】    【@move_speed = 9】

#--------------------------------------------------------------------------

  def refresh
    if @driving
      @map_id = $game_map.map_id
      sync_with_player
    elsif @map_id == $game_map.map_id
      moveto(@x, @y)
    end
    case @type
    when 0
      @priority_type = 1
      @move_speed = 4
    when 1
      @priority_type = 1
      @move_speed = 5
    when 2
      @priority_type = @driving ? 2 : 0
      @move_speed = 6
    end
    @walk_anime = @driving
    @step_anime = @driving
  end
  #--------------------------------------------------------------------------
  # * 变更位置
  #     map_id : 地图编号
  #     x      : 地图X坐标
  #     y      : 地图Y坐标
  #--------------------------------------------------------------------------
  def set_location(map_id, x, y)
    @map_id = map_id
    @x = x
    @y = y
    refresh
  end
  #--------------------------------------------------------------------------
  # * 判定坐标是否匹配
  #     x : 地图X坐标
  #     y : 地图Y坐标
  #--------------------------------------------------------------------------
  def pos?(x, y)
    return (@map_id == $game_map.map_id and super(x, y))
  end
  #--------------------------------------------------------------------------
  # * 判定交通工具显示透明度
  #--------------------------------------------------------------------------
  def transparent
    return (@map_id != $game_map.map_id or super)
  end
  #--------------------------------------------------------------------------
  # * 登上交通工具                  
  #--------------------------------------------------------------------------
                      【★←这里更新1种】      
   【def get_on】
   【@driving = true】
   【@walk_anime = true】
   【@step_anime = true】
   【 if @type == 6】              # 毛毯?
   【@priority_type = 2 】         # 更改显示优先级为[在普通人物上方]
   【end】
   【@bgm.play】                   # 播放交通工具专属BGM
   【end】

  #--------------------------------------------------------------------------
  def get_on
    @driving = true
    @walk_anime = true
    @step_anime = true
    if @type == 2               # 空艇?
      @priority_type = 2        # 更改显示优先级为[在普通人物上方]
    end
    @bgm.play                   # 播放交通工具专属BGM
  end
  #--------------------------------------------------------------------------
  # * 登下交通工具
  #--------------------------------------------------------------------------
  def get_off
    @driving = false
    @walk_anime = false
    @step_anime = false
    @direction = 4
  end
  #--------------------------------------------------------------------------
  # * 与玩家主角坐标同步移动
  #--------------------------------------------------------------------------
  def sync_with_player
    @x = $game_player.x
    @y = $game_player.y
    @real_x = $game_player.real_x
    @real_y = $game_player.real_y
    @direction = $game_player.direction
    update_bush_depth
  end
  #--------------------------------------------------------------------------
  # * 获取行驶速度
  #--------------------------------------------------------------------------
  def speed
    return @move_speed
  end
  #--------------------------------------------------------------------------
  # * 获取屏幕Y坐标差量
  #--------------------------------------------------------------------------
  def screen_y
    return super - altitude
  end
  #--------------------------------------------------------------------------
  # * 通行度判定
  #--------------------------------------------------------------------------
                       【★←这里填加1种】
  【def movable?】
  【return false if (@type == 6 and @altitude < MAX_ALTITUDE)】
  【return (not moving?)】
  【end】

  #--------------------------------------------------------------------------
  def movable?
    return false if (@type == 2 and @altitude < MAX_ALTITUDE)
    return (not moving?)
  end
  #--------------------------------------------------------------------------
  # * 更新帧                                 
  #--------------------------------------------------------------------------
                    【★←这里填加更新帧】

  【def update】
    【super】
    【if @type == 6】           # 毛毯?
    【if @driving】
    【if @altitude < MAX_ALTITUDE】
    【@altitude += 1】          # 高度增加
    【end】
    【elsif @altitude > 0】
    【@altitude -= 1】          # 高度降低
    【if @altitude == 0】
    【@priority_type = 0】      # 恢复显示优先级为[在普通人物下方]
     【end】
   【end】
#--------------------------------------------------------------------------
  def update
    super
    if @type == 2               # 空艇?
      if @driving
        if @altitude < MAX_ALTITUDE
          @altitude += 1        # 高度增加
        end
      elsif @altitude > 0
        @altitude -= 1          # 高度降低
        if @altitude == 0
          @priority_type = 0    # 恢复显示优先级为[在普通人物下方]
        end
      end
    end
  end
end
#--------------------------------------------------------------------------

        以上我说的够清楚了...在看不懂彻底悲具

点评

你自己复制你上的脚本运行看看。end都不配对,def完了没有end的定义也有。麻烦你先把脚本弄好。我复制你的脚本马上报错,end的数量不对。  发表于 2012-10-15 14:32
回复

使用道具 举报

Lv3.寻梦者

伴侣:北岛谜烟

梦石
0
星屑
2967
在线时间
3547 小时
注册时间
2012-8-7
帖子
12181

贵宾

3
发表于 2012-10-15 13:01:09 | 只看该作者
如果是必要改的就在这里修复。
改错的(不想改)可以重新复制新范例里的脚本覆盖。

@protosssonny
本人收不到提醒(点评|回复|@人),总之有事情到空间留言一起普通普通
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
88
在线时间
1906 小时
注册时间
2012-10-5
帖子
1991

开拓者

4
 楼主| 发表于 2012-10-16 15:19:46 | 只看该作者
找到问题了..非常感谢

点评

这奖励要给P叔才对。。  发表于 2012-10-16 17:16
这奖励要给P叔才对。。  发表于 2012-10-16 17:16
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-28 04:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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