查看: 2313|回复: 9

[已经解决] 请问大神怎么制作【查看大地图】的技能 【已解决】

[复制链接]
梦石
0
星屑
878
在线时间
576 小时
注册时间
2010-6-26
回帖
709
发表于 2017-4-9 10:23:53 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 sq333333 于 2017-4-10 10:19 编辑

这个技能可以显示大地图的缩小图,并且用亮点标明主角在大地图中的所在位置。
没有头绪啊,感觉很麻烦
梦石
0
星屑
6375
在线时间
1473 小时
注册时间
2015-7-25
回帖
609

极短25参与开拓者

发表于 2017-4-9 15:26:54 | 显示全部楼层
首先,使用木星ペンギン大大的脚本
  1. =begin

  2. ▼ 簡易マップ表示 ver. 1.5

  3. RPGツクールVXAce用スクリプト

  4. 制作 : 木星ペンギン
  5. URL  : [url=http://woodpenguin.blog.fc2.com/]http://woodpenguin.blog.fc2.com/[/url]

  6. ------------------------------------------------------------------------------
  7. 概要

  8. □ 簡易マップを画面に表示させます。

  9. □ 乗り物擬似3D化と併用する場合、こちらのスクリプトを下にしてください。

  10. ------------------------------------------------------------------------------
  11. 各タイプの説明

  12. □ タイプ 1
  13.   ・プレイヤーの周辺を表示するタイプ。表示範囲は四角形。
  14.   
  15. □ タイプ 2
  16.   ・指定した範囲に収まるように縮小された全体マップを表示するタイプ。
  17.   
  18. □ タイプ 3
  19.   ・プレイヤーの周辺を表示するタイプ。表示範囲は円形。若干処理重め。
  20.   ・<マップ側回転フラグ>はさらに重くなるので注意。
  21.   ・<マップ側回転フラグ>を使用する場合は、高さと幅を同じにしてください。
  22.   
  23. =end

  24. #//////////////////////////////////////////////////////////////////////////////
  25. #
  26. # 設定項目
  27. #
  28. #//////////////////////////////////////////////////////////////////////////////
  29. module WdTk
  30. module SimpMap
  31.   #--------------------------------------------------------------------------
  32.   # ● 画像を参照するフォルダ名
  33.   #--------------------------------------------------------------------------
  34.   DirName = "Graphics/System/"
  35.   
  36.   #--------------------------------------------------------------------------
  37.   # ● 使用するマップ画像
  38.   #     マップ ID をキーとして、マップ画像のファイル名を指定してください。
  39.   #     マップ画像名を "" (空の文字列) にした場合は自動生成されます。
  40.   #     設定していないマップでは、簡易マップは標示されません。
  41.   #--------------------------------------------------------------------------
  42.   Map = {1 => "MAP001.png", 3 => "", 4 => "", 5 => "", 6 => ""}
  43.   
  44.   #--------------------------------------------------------------------------
  45.   # ● 使用する変数 ID
  46.   #     この変数の値で簡易マップの表示タイプを変えることが出来ます。
  47.   #     変数の値が 0 で非表示。他は各設定を参照。
  48.   #--------------------------------------------------------------------------
  49.   VariableID = 1
  50.   
  51.   #--------------------------------------------------------------------------
  52.   # ● 基本設定
  53.   #     変数に入っている数値をキーとして、各パラメータを設定します。
  54.   #--------------------------------------------------------------------------
  55.   Data = {}
  56.   Data[0] = nil  # 非表示
  57.   
  58.   # 変数の値が 1 の場合 (タイプ 1 サンプル)
  59.   params = {}
  60.   params[:type]    = 1           # タイプ
  61.   params[:width]   = 128         # 幅
  62.   params[:height]  = 96          # 高さ
  63.   params[:x]       = Graphics.width - params[:width] - 16   # X 座標
  64.   params[:y]       = Graphics.height - params[:height] - 16 # Y 座標
  65.   params[:opacity] = 200         # 不透明度
  66.   params[:zoom]    = 1.0         # 拡大率
  67.   params[:frame]   = ""          # フレームの画像ファイル名
  68.   Data[1] = params               # 1 に設定
  69.   
  70.   # 変数の値が 2 の場合 (タイプ 2 サンプル)
  71.   params = {}
  72.   params[:type]    = 2           # タイプ
  73.   params[:x]       = 16          # X 座標
  74.   params[:y]       = 16          # Y 座標
  75.   params[:width]   = Graphics.width - params[:x] * 2  # 幅
  76.   params[:height]  = Graphics.height - params[:y] * 2 # 高さ
  77.   params[:opacity] = 224         # 不透明度
  78.   params[:frame]   = ""          # フレームの画像ファイル名
  79.   Data[2] = params               # 2 に設定
  80.   
  81.   # 変数の値が 3 の場合 (タイプ 3 サンプル)
  82.   params = {}
  83.   params[:type]    = 3           # タイプ
  84.   params[:width]   = 128         # 幅
  85.   params[:height]  = 128         # 高さ
  86.   params[:x]       = Graphics.width - params[:width] / 2 - 16   # X 座標
  87.   params[:y]       = Graphics.height - params[:height] / 2 - 16 # Y 座標
  88.   params[:opacity] = 200         # 不透明度
  89.   params[:zoom]    = 1.0         # 拡大率
  90.   params[:turnmap] = true       # マップ回転フラグ(乗り物擬似3D化中のみ)
  91.   params[:frame]   = "map_frame.png"          # フレームの画像ファイル名
  92.   Data[3] = params               # 3 に設定
  93.   
  94.   #--------------------------------------------------------------------------
  95.   # ● マーカー設定
  96.   #     配列に以下の順で設定してください。
  97.   #
  98.   #     画像ファイル名    => 空の文字列("")の場合、自動生成されます。
  99.   #     Y 軸原点位置      => 基準となる位置。(0 : 上 / 1 : 中心 / 2 : 下)
  100.   #     Y 軸原点補正値    => 基準となる位置からの補正値。
  101.   #--------------------------------------------------------------------------
  102.   Player    = ""           # プレイヤーの画像ファイル名
  103.   PlyOrPos  = 1            # プレイヤー画像の Y 軸原点位置
  104.   PlyOrPlus = 0            # プレイヤー画像の Y 軸原点補正値
  105.   TurnPly   = false        # プレイヤーの向きにあわせて画像を回転させるかどうか
  106.   
  107.   Vehicle   = ""           # 乗り物搭乗時の画像ファイル名
  108.   VehOrPos  = 2            # 乗り物画像の Y 軸原点位置
  109.   VehOrPlus = -2           # 乗り物画像の Y 軸原点補正値
  110.   TurnVeh   = true         # 乗り物の向きにあわせて画像を回転させるかどうか
  111.   
  112.   #--------------------------------------------------------------------------
  113.   # ● マーカー自動生成用の設定
  114.   #--------------------------------------------------------------------------
  115.   Radius = 2.0             # マーカーの半径
  116.   
  117.   #--------------------------------------------------------------------------
  118.   # ● マップ自動生成用の設定
  119.   #--------------------------------------------------------------------------
  120.   # タイルの色
  121.   Land = Color.new(192, 192, 192)      # 陸地
  122.   Sea  = Color.new(  0,   0,   0, 128) # 深海
  123.   Ford = Color.new( 64,  64,  64, 192) # 浅瀬・沼
  124.   Mtn  = Color.new( 96,  96,  96)      # 高い山
  125.   Hill = Color.new(128, 128, 128)      # 低い山
  126.   Fst  = Color.new(160, 160, 160)      # 森
  127.   
  128.   TileSize  = 4           # 1 タイルの大きさ
  129.   MapBlur   = true        # ぼかし処理
  130.   StartInit = false       # ゲーム起動時にマップ生成

  131. #//////////////////////////////////////////////////////////////////////////////
  132. #
  133. # 以降、変更する必要なし
  134. #
  135. #//////////////////////////////////////////////////////////////////////////////

  136.   def self.init
  137.     Data.each_value do |params|
  138.       next unless params && params[:type] == 3
  139.       params[:cal] = []
  140.       w = params[:width] / params[:zoom] / 2
  141.       h = params[:height] / params[:zoom] / 2
  142.       (h * 2).to_i.times do |i|
  143.         params[:cal] << (Math.sqrt(h ** 2 - (h - i - 0.5) ** 2) * w / h).to_i
  144.       end
  145.     end
  146.     return unless StartInit
  147.     Map.each do |map_id, name|
  148.       WdTk.save_simplemap(map_id, create_simplemap(map_id)) if name.empty?
  149.     end
  150.   end
  151.   def self.create_simplemap(map_id)
  152.     map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  153.     bitmap = Bitmap.new(map.width * TileSize, map.height * TileSize)
  154.     map.width.times do |x|; map.height.times do |y|
  155.       index0 = (map.data[x, y, 0] - 2048) / 48
  156.       index1 = (map.data[x, y, 1] - 2048) / 48
  157.       if index0 < 16
  158.         color = (index1 == 1 ? Sea : Ford)
  159.       else
  160.         case index1
  161.         when 20,21,28,36,44; color = Fst
  162.         when 22,30,38,46;    color = Hill
  163.         when 23,31,39,47;    color = Mtn
  164.         else                 color = Land
  165.         end
  166.       end
  167.       bitmap.fill_rect(x * TileSize, y * TileSize, TileSize, TileSize, color)
  168.     end; end
  169.     bitmap.blur if MapBlur
  170.     bitmap
  171.   end
  172.   
  173. end

  174.   [url=home.php?mod=space&uid=341345]@Cache[/url] ||= {}
  175.   def self.load_simplemap(map_id)
  176.     key = sprintf("SimpleMap/%03d", map_id)
  177.     @cache.delete(key) if @cache.include?(key) && @cache[key].disposed?
  178.     @cache[key] ||= SimpMap.create_simplemap(map_id)
  179.   end
  180.   def self.save_simplemap(map_id, bitmap)
  181.     key = sprintf("SimpleMap/%03d", map_id)
  182.     @cache[key] = bitmap
  183.   end
  184.   def self.delete_simplemap(map_id)
  185.     key = sprintf("SimpleMap/%03d", map_id)
  186.     @cache.delete(key)
  187.   end
  188.   
  189.   @material ||= []
  190.   @material << :SimpMap
  191.   def self.include?(sym)
  192.     @material.include?(sym)
  193.   end
  194.   
  195. end

  196. #==============================================================================
  197. # ■ Bitmap
  198. #==============================================================================
  199. class Bitmap
  200.   #--------------------------------------------------------------------------
  201.   # ● 円の描写
  202.   #--------------------------------------------------------------------------
  203.   def draw_circle(x, y, radius, color)
  204.     r = radius.ceil
  205.     (x - r).upto(x + r) do |dx|
  206.       (y - r).upto(y + r) do |dy|
  207.         color.alpha = 192 * (radius + 0.5 - Math.hypot(x - dx - 0.5, y - dy - 0.5))
  208.         set_pixel(dx, dy, color)
  209.       end
  210.     end
  211.   end
  212. end

  213. #==============================================================================
  214. # ■ DataManager
  215. #==============================================================================
  216. class << DataManager
  217.   #--------------------------------------------------------------------------
  218.   # ◯ モジュール初期化
  219.   #--------------------------------------------------------------------------
  220.   alias _wdtk_simpmap_init init
  221.   def init
  222.     _wdtk_simpmap_init
  223.     WdTk::SimpMap.init
  224.   end
  225. end

  226. #==============================================================================
  227. # ■ Game_Player
  228. #==============================================================================
  229. class Game_Player
  230.   #--------------------------------------------------------------------------
  231.   # ● マーカーの色
  232.   #--------------------------------------------------------------------------
  233.   def mark_index
  234.     return 0
  235.   end
  236. end

  237. #==============================================================================
  238. # ■ Game_Vehicle
  239. #==============================================================================
  240. class Game_Vehicle
  241.   #--------------------------------------------------------------------------
  242.   # ● マーカーの色
  243.   #--------------------------------------------------------------------------
  244.   def mark_index
  245.     return 6
  246.   end
  247. end

  248. #==============================================================================
  249. # ■ Game_Event
  250. #==============================================================================
  251. class Game_Event
  252.   #--------------------------------------------------------------------------
  253.   # ● 公開インスタンス変数
  254.   #--------------------------------------------------------------------------
  255.   attr_reader   :mark_index
  256.   #--------------------------------------------------------------------------
  257.   # ◯ イベントページの設定をセットアップ
  258.   #--------------------------------------------------------------------------
  259.   alias _wdtk_simpmap_setup_page_settings setup_page_settings
  260.   def setup_page_settings
  261.     _wdtk_simpmap_setup_page_settings
  262.     clear_simpmap_params
  263.     setup_simpmap_params
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ● イベント内容から設定をセットアップ
  267.   #--------------------------------------------------------------------------
  268.   def setup_simpmap_params
  269.     @list.each do |cmd|
  270.       case cmd.code
  271.       when 108,408
  272.         case cmd.parameters[0]
  273.         when /マーカー\s*[::]\s*(\d+)/
  274.           @mark_index = $1.to_i
  275.         end
  276.       else
  277.         return
  278.       end
  279.     end
  280.   end
  281.   #--------------------------------------------------------------------------
  282.   # ● イベント立体表示の設定をクリア
  283.   #--------------------------------------------------------------------------
  284.   def clear_simpmap_params
  285.     @mark_index = nil
  286.   end
  287. end

  288. #==============================================================================
  289. # ■ Spriteset_SimpleMap
  290. #==============================================================================
  291. class Spriteset_SimpleMap
  292.   #--------------------------------------------------------------------------
  293.   # ● モジュール
  294.   #--------------------------------------------------------------------------
  295.   include WdTk::SimpMap
  296.   #--------------------------------------------------------------------------
  297.   # ● オブジェクト初期化
  298.   #--------------------------------------------------------------------------
  299.   def initialize
  300.     @update_count = 0
  301.     @marker_bitmaps = {}
  302.     @rect = Rect.new
  303.     create_simpmap
  304.     create_marker
  305.     create_player
  306.     create_frame
  307.     create_map_bitmap
  308.     update
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● 簡易マップの作成
  312.   #--------------------------------------------------------------------------
  313.   def create_simpmap
  314.     @simpmap_sprite = Sprite.new
  315.     @simpmap_sprite.z = 150
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● マーカーの作成
  319.   #--------------------------------------------------------------------------
  320.   def create_marker
  321.     @marker_sprite = Sprite.new
  322.     @marker_sprite.z = 151
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● プレイヤーの作成
  326.   #--------------------------------------------------------------------------
  327.   def create_player
  328.     @player_sprite = Sprite.new
  329.     @player_sprite.z = 152
  330.     if Player.empty?
  331.       i = $game_player.mark_index
  332.       @player_bitmap = make_marker(get_color(i), Radius)
  333.     else
  334.       @player_bitmap = Cache.load_bitmap(DirName, Player)
  335.     end
  336.     if !Vehicle.empty?
  337.       @vehicle_bitmap = Cache.load_bitmap(DirName, Vehicle)
  338.     elsif TurnVeh
  339.       i = $game_player.mark_index
  340.       @vehicle_bitmap = make_marker(get_color(i), Radius, 1)
  341.     else
  342.       @vehicle_bitmap = @player_bitmap
  343.     end
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● フレームの作成
  347.   #--------------------------------------------------------------------------
  348.   def create_frame
  349.     @frame_sprite = Sprite.new
  350.     @frame_sprite.z = 152
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # ● マップ画像の作成
  354.   #--------------------------------------------------------------------------
  355.   def create_map_bitmap
  356.     @loop_bitmap.dispose if @loop_bitmap
  357.     if !Map.include?($game_map.map_id)
  358.       @loop_bitmap = nil
  359.       return
  360.     elsif !Map[$game_map.map_id].empty?
  361.       map_bitmap = Cache.load_bitmap(DirName, Map[$game_map.map_id])
  362.     else
  363.       map_bitmap = WdTk.load_simplemap($game_map.map_id)
  364.     end
  365.     @map_width = map_bitmap.width
  366.     @map_height = map_bitmap.height
  367.     width = $game_map.loop_horizontal? ? @map_width * 2 : @map_width
  368.     height = $game_map.loop_vertical? ? @map_height * 2 : @map_height
  369.     @loop_bitmap = Bitmap.new(width, height)
  370.     @loop_bitmap.blt(0,           0, map_bitmap, map_bitmap.rect)
  371.     @loop_bitmap.blt(@map_width,  0, map_bitmap, map_bitmap.rect)
  372.     @loop_bitmap.blt(0, @map_height, @loop_bitmap, @loop_bitmap.rect)
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● 色の取得
  376.   #--------------------------------------------------------------------------
  377.   def get_color(index)
  378.     bitmap = Cache.system("Window")
  379.     bitmap.get_pixel(64 + (index % 8) * 8, 96 + (index / 8) * 8)
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # ● マーカー画像の取得
  383.   #--------------------------------------------------------------------------
  384.   def make_marker(color, radius, type=0)
  385.     r = radius.ceil
  386.     case type
  387.     when 0
  388.       bitmap = Bitmap.new(r * 2, r * 2)
  389.       bitmap.draw_circle(r, r, radius, color)
  390.     when 1
  391.       bitmap = Bitmap.new(r * 2, r * 4)
  392.       bitmap.draw_circle(r, r, radius / 2.0, color)
  393.       bitmap.draw_circle(r, r * 3, radius, color)
  394.     end
  395.     bitmap
  396.   end
  397.   #--------------------------------------------------------------------------
  398.   # ● 解放
  399.   #--------------------------------------------------------------------------
  400.   def dispose
  401.     @simpmap_sprite.dispose
  402.     @loop_bitmap.dispose if @loop_bitmap
  403.     @marker_sprite.bitmap.dispose if @marker_sprite.bitmap
  404.     @marker_sprite.dispose
  405.     @player_sprite.dispose
  406.     @frame_sprite.dispose
  407.     @player_bitmap.dispose
  408.     @vehicle_bitmap.dispose
  409.     @marker_bitmaps.each_value {|bitmap| bitmap.dispose }
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● ビューポートの設定
  413.   #--------------------------------------------------------------------------
  414.   def viewport=(v)
  415.     @simpmap_sprite.viewport = v
  416.     @marker_sprite.viewport = v
  417.     @player_sprite.viewport = v
  418.     @frame_sprite.viewport = v
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ● セットアップ
  422.   #--------------------------------------------------------------------------
  423.   def setup
  424.     @simpmap_sprite.bitmap.dispose if @params && @params[:type] == 3
  425.     @marker_sprite.bitmap.dispose if @marker_sprite.bitmap
  426.     @params = (@loop_bitmap ? Data[@index] : nil)
  427.     case (@params ? @params[:type] : 0)
  428.     when 1 # 一部拡大四角表示
  429.       [url=home.php?mod=space&uid=98379]@zoom[/url] = @params[:zoom]
  430.       @rect.width = [@params[:width], @map_width * @zoom].min
  431.       @rect.height = [@params[:height], @map_height * @zoom].min
  432.       @rect.x = @params[:x] + (@params[:width] - @rect.width) / 2
  433.       @rect.y = @params[:y] + (@params[:height] - @rect.height) / 2
  434.       setup_square
  435.     when 2 # 全体表示
  436.       @zoom = [@params[:width].to_f / @map_width,
  437.                @params[:height].to_f / @map_height].min
  438.       @rect.width = @map_width * @zoom
  439.       @rect.height = @map_height * @zoom
  440.       @rect.x = @params[:x] + (@params[:width] - @rect.width) / 2
  441.       @rect.y = @params[:y] + (@params[:height] - @rect.height) / 2
  442.       setup_square
  443.     when 3 # 一部拡大円形表示
  444.       @zoom = @params[:zoom]
  445.       @rect.set(@params[:x], @params[:y], @params[:width], @params[:height])
  446.       setup_circle
  447.     else   # 表示しない
  448.       @simpmap_sprite.visible = @marker_sprite.visible =
  449.       @player_sprite.visible = @frame_sprite.visible = false
  450.       return
  451.     end
  452.     @update_count = 71
  453.   end
  454.   #--------------------------------------------------------------------------
  455.   # ● 共通のセットアップ
  456.   #--------------------------------------------------------------------------
  457.   def setup_base
  458.     @simpmap_sprite.visible = true
  459.     @simpmap_sprite.x = @rect.x
  460.     @simpmap_sprite.y = @rect.y
  461.     @simpmap_sprite.zoom_x = @simpmap_sprite.zoom_y = @zoom
  462.     @marker_sprite.visible = true
  463.     @marker_sprite.x = @rect.x
  464.     @marker_sprite.y = @rect.y
  465.     @player_sprite.visible = true
  466.     if @params[:frame] && !@params[:frame].empty?
  467.       @frame_sprite.visible = true
  468.       @frame_sprite.bitmap = Cache.load_bitmap(DirName, @params[:frame])
  469.     else
  470.       @frame_sprite.visible = false
  471.     end
  472.     @simpmap_sprite.opacity = @params[:opacity]
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   # ● 四角タイプのセットアップ
  476.   #--------------------------------------------------------------------------
  477.   def setup_square
  478.     setup_base
  479.     @simpmap_sprite.bitmap = @loop_bitmap
  480.     @simpmap_sprite.ox = @simpmap_sprite.oy = 0
  481.     @simpmap_sprite.angle = 0
  482.     w = (@rect.width / @zoom).ceil
  483.     h = (@rect.height / @zoom).ceil
  484.     @simpmap_sprite.src_rect.set(0, 0, w, h)
  485.     w = @map_width * @zoom * 2
  486.     h = @map_height * @zoom * 2
  487.     @marker_sprite.bitmap = Bitmap.new(w, h)
  488.     @marker_sprite.ox = @marker_sprite.oy = 0
  489.     @marker_sprite.src_rect.set(@rect)
  490.     @frame_sprite.x = @rect.x + (@rect.width - @frame_sprite.width) / 2
  491.     @frame_sprite.y = @rect.y + (@rect.height - @frame_sprite.height) / 2
  492.     @frame_sprite.ox = @frame_sprite.oy = 0
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● 円形タイプのセットアップ
  496.   #--------------------------------------------------------------------------
  497.   def setup_circle
  498.     setup_base
  499.     w = (@rect.width / @zoom).ceil
  500.     h = (@rect.height / @zoom).ceil
  501.     @simpmap_sprite.bitmap = Bitmap.new(w, h)
  502.     @simpmap_sprite.ox = w / 2
  503.     @simpmap_sprite.oy = h / 2
  504.     @simpmap_sprite.zoom_x = @simpmap_sprite.zoom_y = @zoom
  505.     @marker_sprite.bitmap = Bitmap.new(@rect.width, @rect.height)
  506.     @marker_sprite.ox = @rect.width / 2
  507.     @marker_sprite.oy = @rect.height / 2
  508.     @marker_sprite.opacity = 255
  509.     @frame_sprite.x = @rect.x
  510.     @frame_sprite.y = @rect.y
  511.     @frame_sprite.ox = @frame_sprite.width / 2
  512.     @frame_sprite.oy = @frame_sprite.height / 2
  513.   end
  514.   #--------------------------------------------------------------------------
  515.   # ● フレーム更新
  516.   #--------------------------------------------------------------------------
  517.   def update
  518.     if @map_id != $game_map.map_id || @index != $game_variables[VariableID]
  519.       create_map_bitmap if @map_id != $game_map.map_id
  520.       @map_id = $game_map.map_id
  521.       @index = $game_variables[VariableID]
  522.       setup
  523.     end
  524.     if @params
  525.       case @params[:type]
  526.       when 1; update_all_marker(true)
  527.       when 2; update_all_marker(false)
  528.       when 3; update_type3
  529.       end
  530.     end
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # ● 全マーカーの更新
  534.   #--------------------------------------------------------------------------
  535.   def update_all_marker(loop = true)
  536.     @update_count = (@update_count + 1) % 72
  537.     player = vehicle? ? $game_player.vehicle : $game_player
  538.     px = (player.real_x + 0.5) * @map_width / $game_map.width
  539.     py = (player.real_y + 0.5) * @map_height / $game_map.height
  540.     ox = px - (@rect.width / @zoom / 2).ceil
  541.     unless loop && $game_map.loop_horizontal?
  542.       ox = [[ox, @map_width - @simpmap_sprite.width].min, 0].max
  543.     end
  544.     ox %= @map_width
  545.     oy = py - (@rect.height / @zoom / 2).ceil
  546.     unless loop && $game_map.loop_vertical?
  547.       oy = [[oy, @map_height - @simpmap_sprite.height].min, 0].max
  548.     end
  549.     oy %= @map_height
  550.     update_player(px - ox, py - oy)
  551.     update_simpmap(ox, oy)
  552.     update_marker(ox, oy)
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● プレイヤーの更新
  556.   #--------------------------------------------------------------------------
  557.   def update_player(x, y)
  558.     if vehicle?
  559.       @player_sprite.bitmap = @vehicle_bitmap
  560.       case VehOrPos
  561.       when 0; @player_sprite.oy = VehOrPlus
  562.       when 1; @player_sprite.oy = @player_sprite.height / 2 + VehOrPlus
  563.       when 2; @player_sprite.oy = @player_sprite.height + VehOrPlus
  564.       end
  565.       if WdTk.include?(:Veh3D)
  566.         @player_sprite.angle = TurnVeh ? $game_player.vehicle.angle : 0
  567.       else
  568.         @player_sprite.angle = TurnVeh ? player_angle : 0
  569.       end
  570.     else
  571.       @player_sprite.bitmap = @player_bitmap
  572.       case PlyOrPos
  573.       when 0; @player_sprite.oy = PlyOrPlus
  574.       when 1; @player_sprite.oy = @player_sprite.height / 2 + PlyOrPlus
  575.       when 2; @player_sprite.oy = @player_sprite.height + PlyOrPlus
  576.       end
  577.       @player_sprite.angle = (TurnPly ? player_angle : 0)
  578.     end
  579.     @player_sprite.ox = @player_sprite.width / 2
  580.     @player_sprite.x = @rect.x + x % @map_width * @zoom
  581.     @player_sprite.y = @rect.y + y % @map_height * @zoom
  582.   end
  583.   #--------------------------------------------------------------------------
  584.   # ● 簡易マップの更新
  585.   #--------------------------------------------------------------------------
  586.   def update_simpmap(x, y)
  587.     @simpmap_sprite.src_rect.x = x
  588.     @simpmap_sprite.src_rect.y = y
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # ● マーカーの更新
  592.   #--------------------------------------------------------------------------
  593.   def update_marker(x, y)
  594.     @marker_sprite.opacity = 256 - @update_count * 3
  595.     redraw_marker if @update_count == 0
  596.     @marker_sprite.src_rect.x = x * @zoom
  597.     @marker_sprite.src_rect.y = y * @zoom
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   # ● マーカーの再描写
  601.   #--------------------------------------------------------------------------
  602.   def redraw_marker
  603.     bitmap = @marker_sprite.bitmap
  604.     bitmap.clear
  605.     x_rate = bitmap.width / 2.0 / $game_map.width
  606.     y_rate = bitmap.height / 2.0 / $game_map.height
  607.     all_events.each do |event|
  608.       i = event.mark_index
  609.       next unless i
  610.       @marker_bitmaps[i] ||= make_marker(get_color(i), Radius)
  611.       marker = @marker_bitmaps[i]
  612.       ex = (event.x + 0.5) * x_rate - marker.width / 2
  613.       ey = (event.y + 0.5) * y_rate - marker.height / 2
  614.       bitmap.blt(ex, ey, marker, marker.rect)
  615.     end
  616.     bitmap.blt(bitmap.width / 2,  0, bitmap, bitmap.rect)
  617.     bitmap.blt(0, bitmap.height / 2, bitmap, bitmap.rect)
  618.   end
  619.   #--------------------------------------------------------------------------
  620.   # ● 全てのイベントを取得
  621.   #--------------------------------------------------------------------------
  622.   def all_events
  623.     $game_map.events.values +
  624.     $game_map.vehicles.reject {|v| v.transparent || v.driving }
  625.   end
  626.   #--------------------------------------------------------------------------
  627.   # ● 乗り物に乗っているかどうか
  628.   #--------------------------------------------------------------------------
  629.   def vehicle?
  630.     if WdTk.include?(:Veh3D)
  631.       $game_player.in_vehicle
  632.     else
  633.       $game_player.vehicle && $game_player.vehicle.movable?
  634.     end
  635.   end
  636.   #--------------------------------------------------------------------------
  637.   # ● プレイヤーの向きから角度を取得
  638.   #--------------------------------------------------------------------------
  639.   def player_angle
  640.     case $game_player.direction
  641.     when 2; 180
  642.     when 4; 90
  643.     when 6; 270
  644.     when 8; 0
  645.     end
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # ● フレーム更新 (タイプ 3)
  649.   #--------------------------------------------------------------------------
  650.   def update_type3
  651.     @update_count = (@update_count + 1) % 72
  652.     if WdTk.include?(:Veh3D) && $game_player.in_vehicle
  653.       return unless WdTk::Veh3D.update_even?
  654.     else
  655.       return if @update_count.odd?
  656.     end
  657.     player = vehicle? ? $game_player.vehicle : $game_player
  658.     px = (player.real_x + 0.5) * @map_width / $game_map.width
  659.     py = (player.real_y + 0.5) * @map_height / $game_map.height
  660.     ox = (px - @rect.width / @zoom / 2)
  661.     ox %= @map_width if $game_map.loop_horizontal?
  662.     oy = (py - @rect.height / @zoom / 2)
  663.     oy %= @map_height if $game_map.loop_vertical?
  664.     update_player(0, 0)
  665.     update_simpmap_t3(ox, oy)
  666.     update_marker_t3(player)
  667.     if turn_map?
  668.       @player_sprite.angle = 0
  669.       @simpmap_sprite.angle = -player.angle
  670.       @frame_sprite.angle = -player.angle
  671.     end
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # ● 簡易マップの更新(タイプ 3 用)
  675.   #--------------------------------------------------------------------------
  676.   def update_simpmap_t3(x, y)
  677.     bitmap = @simpmap_sprite.bitmap
  678.     bitmap.clear
  679.     rect = Rect.new
  680.     @params[:cal].each_with_index do |n, i|
  681.       m = (@rect.width / 2 / @zoom).ceil - n
  682.       rect.set(x + m, y + i, n * 2, 1)
  683.       bitmap.blt(m, i, @loop_bitmap, rect)
  684.     end
  685.   end
  686.   #--------------------------------------------------------------------------
  687.   # ● マーカーの更新(タイプ 3 用)
  688.   #--------------------------------------------------------------------------
  689.   def update_marker_t3(player)
  690.     @marker_sprite.opacity = 256 - @update_count * 3
  691.     bitmap = @marker_sprite.bitmap
  692.     bitmap.clear
  693.     x_rate = @map_width / $game_map.width * @zoom
  694.     y_rate = @map_height / $game_map.height * @zoom
  695.     psx = $game_map.adjust_x(player.real_x)
  696.     psy = $game_map.adjust_y(player.real_y)
  697.     cx = bitmap.width / 2
  698.     cy = bitmap.height / 2
  699.     radian = turn_map? ? -player.angle * Math::PI / 180 : 0
  700.     all_events.each do |event|
  701.       i = event.mark_index
  702.       next unless i
  703.       dx = (($game_map.adjust_x(event.real_x) - psx) * x_rate).to_i
  704.       dy = (($game_map.adjust_y(event.real_y) - psy) * y_rate).to_i
  705.       next unless dy.between?(-cy, cy)
  706.       m = Math.sqrt(cy ** 2 - dy ** 2) * cx / cy
  707.       next unless dx.between?(-m, m)
  708.       @marker_bitmaps[i] ||= make_marker(get_color(i), Radius)
  709.       marker = @marker_bitmaps[i]
  710.       if radian != 0 && (dx != 0 || dy != 0)
  711.         rr = Math.atan2(dx, dy) + radian
  712.         ed = Math.hypot(dx, dy)
  713.         dx = (ed * Math.sin(rr)).to_i
  714.         dy = (ed * Math.cos(rr)).to_i
  715.       end
  716.       mx = cx + dx - marker.width / 2
  717.       my = cy + dy - marker.height / 2
  718.       bitmap.blt(mx, my, marker, marker.rect)
  719.     end
  720.   end
  721.   #--------------------------------------------------------------------------
  722.   # ● マップ側を回転させるかどうか
  723.   #--------------------------------------------------------------------------
  724.   def turn_map?
  725.     WdTk.include?(:Veh3D) && $game_player.in_vehicle && @params[:turnmap]
  726.   end
  727. end

  728. #==============================================================================
  729. # ■ Spriteset_Map
  730. #==============================================================================
  731. class Spriteset_Map
  732.   #--------------------------------------------------------------------------
  733.   # ○ オブジェクト初期化
  734.   #--------------------------------------------------------------------------
  735.   alias _wdtk_simpmap_initialize initialize
  736.   def initialize
  737.     create_simpmap
  738.     _wdtk_simpmap_initialize
  739.   end
  740.   #--------------------------------------------------------------------------
  741.   # ○ 解放
  742.   #--------------------------------------------------------------------------
  743.   alias _wdtk_simpmap_dispose dispose
  744.   def dispose
  745.     @spriteset_simpmap.dispose
  746.     _wdtk_simpmap_dispose
  747.   end
  748.   #--------------------------------------------------------------------------
  749.   # ○ フレーム更新
  750.   #--------------------------------------------------------------------------
  751.   alias _wdtk_simpmap_update update
  752.   def update
  753.     _wdtk_simpmap_update
  754.     @spriteset_simpmap.update
  755.   end
  756.   #--------------------------------------------------------------------------
  757.   # ● 簡易マップの作成
  758.   #--------------------------------------------------------------------------
  759.   def create_simpmap
  760.     @spriteset_simpmap   = Spriteset_SimpleMap.new
  761.   end
  762. end

  763. if WdTk.include?(:Veh3D)
  764. module WdTk::Veh3D
  765.   def self.update_even?
  766.     need_update? && @@frame_count.even?
  767.   end
  768. end
  769. #==============================================================================
  770. # ■ Scene_Vehicle
  771. #==============================================================================
  772. class Scene_Vehicle
  773.   #--------------------------------------------------------------------------
  774.   # ● 簡易マップの作成
  775.   #--------------------------------------------------------------------------
  776.   def create_simpmap
  777.     super
  778.     @spriteset_simpmap.viewport = @window_viewport
  779.   end
  780. end
  781. end
复制代码



然后,先看这个脚本的注释得知了使用方法是通过改变变量1的值来显示地图,而地图文件则需要放进Graphics/System/文件夹里
那么变量1的值为2的时候则在正中央显示整张地图(具体看注释)
于是,我们就开始制作技能了。
QQ图片20170409151757.png
QQ图片20170409151816.png
QQ图片20170409151854.png
QQ图片20170409152027.png

评分

参与人数 1梦石 +1 收起 理由
RaidenInfinity + 1 认可答案

查看全部评分

笨肉包的游戏讨论群932812135 (实时更新) 喜欢的话欢迎加入~
目前的坑
??? #像素风OC游戏 准备中 短篇-约5小时
花城梦之心 #像素风OC游戏 系统开发+素材绘制中
【不可思议的迷宫】幽灵契约外传:歌莉娅 v0.4 游戏文件已更新
同时更新中~ (沉迷摸鱼中~更新速度较慢请见谅w)
这是属于笨肉包一个人的旅行~(这只肉包又在摸鱼!
旅途的最终目标~ ???(保密~
回复

使用道具 举报

梦石
0
星屑
878
在线时间
576 小时
注册时间
2010-6-26
回帖
709
 楼主| 发表于 2017-4-9 23:09:20 | 显示全部楼层
魔法丶小肉包 发表于 2017-4-9 15:26
首先,使用木星ペンギン大大的脚本
=begin

大神这个脚本这里报错怎么办呀?
2017-04-09_230523.jpg

点评

这是论坛的BUG,把186行改成 @Cache ||= {} 即可  发表于 2017-4-10 00:07
回复

使用道具 举报

梦石
0
星屑
5037
在线时间
1780 小时
注册时间
2012-7-3
回帖
1749

开拓者

发表于 2017-4-9 23:13:06 | 显示全部楼层
不用脚本的话……
直接找一张大地图的图片然后通过换算坐标将示意主角位置的点叠上去就好啦……

点评

那种的也可以啊,拿一个点把整个地图遍历一边就行了 遍历的结果显示在底层,上面照样叠主角位置就行了_(:з)∠)_ 脚本做的事情其实和这个差不多  发表于 2017-4-10 14:47
除非是那种野外生存、随机地牢类的游戏,地图会随时发生变化,那个倒是必须需要一个生成小地图的脚本……  发表于 2017-4-10 11:15
而且通用啊…… 同样的方法换到fusion或者construct里面照样能用_(:з)∠)_  发表于 2017-4-10 09:58
其实我也觉得这样最好,用事件就能解决,又方便又无冲突。但是懒得人还是多啊,懒得画大地图……  发表于 2017-4-10 00:32
Project Ktr进行中:
   
------------------
→SRPG开发之六-天气与地形互动
→→围观
→→→去Lofter围观
------------------
离经叛道的扯淡者/伪独立游戏爱好者/Decade Studio(?)/造轮子真TM开心呀
回复

使用道具 举报

梦石
0
星屑
878
在线时间
576 小时
注册时间
2010-6-26
回帖
709
 楼主| 发表于 2017-4-10 10:18:55 | 显示全部楼层
魔法丶小肉包 发表于 2017-4-9 15:26
首先,使用木星ペンギン大大的脚本
=begin

感谢大神!我好好研究下这个脚本!!
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部