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

Project1

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

[已经过期] 小地图显示,求指点

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
跳转到指定楼层
1
发表于 2013-9-19 14:07:14 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 guoyq1988 于 2013-9-30 20:24 编辑

用了八方向的行走图和小地图2个脚本
可是在小地图上显示的是4个行走图,想请大神帮忙修改下
怎么让小地图显示的行走图变成一个或者用另一张图片显示
如显示的行走图用一个红点的图片代替这样的。。
求指点,谢谢

不好意思,中午电脑突然卡死,没把脚本发上,补上脚本


RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. #==============================================================================
  6. # ■ 縮小地图的表示(ver 0.999)
  7. # by ピニョン clum-sea
  8. #==============================================================================
  9. #==============================================================================
  10. # □ 前期定义
  11. #==============================================================================
  12. module PLAN_Map_Window
  13.   WIN_X       = 440        # 地图的 X 座標
  14.   WIN_Y       = 0         # 地图的 Y 座標
  15.   WIN_WIDTH   = 9*22      # 地图的宽度
  16.   WIN_HEIGHT  = 7*22      # 地图的高度
  17.   ZOOM        = 9.0       # 地图的放缩比例
  18.   WINDOWSKIN  = "1.png"        # 自定义地图窗口素材,如果留空则是默认的
  19.  
  20.   ON_OFF_KEY  = Input::A  # 打开地图的按钮,A就是键盘的Z键
  21.  
  22.   SWITCH      = 100       # 禁用地图功能的开关,默认这个就是打开100号开关则禁止
  23.                           # 使用地图功能,关闭则可以使用地图功能
  24.  
  25.   WINDOW_MOVE = false      # 窗口中的地图跟随移动,(true:跟随, false:固定)
  26.  
  27.   OVER_X      = 632 - WIN_WIDTH   # 移動后的 X 座標(初期位置と往復します)
  28.   OVER_Y      = 8         # 移動后的 Y 座標(初期位置と往復します)
  29.  
  30.   OPACITY     = 200       # 窗口的透明度
  31.   C_OPACITY   = 220       # 地图的透明度
  32.   VISIBLE     = false     # 最初是否可见
  33. end
  34. #==============================================================================
  35. # ■ Game_Temp
  36. #==============================================================================
  37. class Game_Temp
  38.   attr_accessor  :map_visible     # 地图的表示状態
  39.   alias plan_map_window_initialize initialize
  40.   def initialize
  41.     plan_map_window_initialize
  42.     @map_visible = false
  43.   end
  44. end
  45. #==============================================================================
  46. # ■ Scene_Map
  47. #==============================================================================
  48. class Scene_Map
  49.   #--------------------------------------------------------------------------
  50.   # ● 主处理
  51.   #--------------------------------------------------------------------------
  52.   alias plan_map_window_main main
  53.   def main
  54.     @map_window         = Window_Map.new
  55.     @map_window.visible = $game_temp.map_visible
  56.     plan_map_window_main
  57.     @map_window.dispose
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 更新
  61.   #--------------------------------------------------------------------------
  62.   alias plan_map_window_update update
  63.   def update
  64.     $game_temp.map_visible = @map_window.visible
  65.     plan_map_window_update
  66.     unless $game_switches[PLAN_Map_Window::SWITCH]      
  67.       if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY)
  68.         if @map_window.visible
  69.           @map_window.visible = false
  70.         else
  71.           @map_window.visible = true
  72.         end
  73.       end
  74.     else
  75.       if @map_window.visible
  76.         @map_window.visible = false
  77.       end
  78.     end
  79.     if @map_window.visible
  80.       @map_window.update
  81.     end
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 场所移动的变化
  85.   #--------------------------------------------------------------------------
  86.   alias plan_map_window_transfer_player transfer_player
  87.   def transfer_player
  88.     visible = @map_window.visible
  89.     @map_window.visible = false
  90.     plan_map_window_transfer_player
  91.     @map_window.dispose
  92.     @map_window = Window_Map.new
  93.     @map_window.visible = visible
  94.   end
  95. end
  96. #==============================================================================
  97. # ■ Window_Map
  98. #==============================================================================
  99. class Window_Map < Window_Base
  100.   #--------------------------------------------------------------------------
  101.   # ● 初始化
  102.   #--------------------------------------------------------------------------
  103.   def initialize
  104.     x = PLAN_Map_Window::WIN_X
  105.     y = PLAN_Map_Window::WIN_Y
  106.     w = PLAN_Map_Window::WIN_WIDTH
  107.     h = PLAN_Map_Window::WIN_HEIGHT
  108.     super(x, y, w, h)
  109.     unless PLAN_Map_Window::WINDOWSKIN.empty?
  110.       self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN)
  111.     end
  112.     self.contents = Bitmap.new(width - 32, height - 32)
  113.     self.opacity = PLAN_Map_Window::OPACITY
  114.     self.contents_opacity = PLAN_Map_Window::C_OPACITY
  115.     @map_data = $game_map.data
  116.     @tileset = RPG::Cache.tileset($game_map.tileset_name)
  117.     @autotiles = []
  118.     for i in 0..6
  119.       autotile_name = $game_map.autotile_names[i]
  120.       @autotiles[i] = RPG::Cache.autotile(autotile_name)
  121.     end
  122.     @old_real_x = $game_player.real_x
  123.     @old_real_y = $game_player.real_y
  124.     @all_map = make_all_map
  125.     self.visible = PLAN_Map_Window::VISIBLE
  126.     refresh
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● 缩小图做成
  130.   #--------------------------------------------------------------------------
  131.   def make_all_map
  132.     all_map = Bitmap.new($game_map.width * 32, $game_map.height * 32)
  133.     for y in 0...$game_map.height
  134.       for x in 0...$game_map.width
  135.         for z in 0...3
  136.           tile_num = @map_data[x, y, z]
  137.           next if tile_num == nil
  138.           if tile_num < 384
  139.             if tile_num >= 48
  140.               tile_num -= 48
  141.               src_rect = Rect.new(32, 2 * 32, 32, 32)
  142.               all_map.blt(x * 32, y * 32, @autotiles[tile_num / 48], src_rect)
  143.             end
  144.           else
  145.             tile_num -= 384
  146.             src_rect = Rect.new(tile_num % 8 * 32, tile_num / 8 * 32, 32, 32)
  147.             all_map.blt(x * 32, y * 32, @tileset, src_rect)
  148.           end
  149.         end
  150.       end
  151.     end
  152.     w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32
  153.     h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32
  154.     ret_bitmap = Bitmap.new(w, h)
  155.     src_rect = Rect.new(0, 0, all_map.width, all_map.height)
  156.     dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
  157.     ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
  158.     all_map.dispose
  159.     return ret_bitmap
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 刷新
  163.   #--------------------------------------------------------------------------
  164.   def refresh
  165.     self.contents.clear
  166.     one_tile_size = 32 / PLAN_Map_Window::ZOOM
  167.     x = $game_player.real_x - 128 * (self.contents.width / one_tile_size) / 2
  168.     y = $game_player.real_y - 128 * (self.contents.height / one_tile_size) / 2
  169.     x = x * one_tile_size / 128
  170.     y = y * one_tile_size / 128
  171.     half_width = self.contents.width * 128 / 2
  172.     rest_width = ($game_map.width * 128 - $game_player.real_x) * one_tile_size
  173.     rev_x = 0
  174.     if @all_map.width < self.contents.width
  175.       rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
  176.       rev_x -= (self.contents.width - @all_map.width) / 2
  177.       x += rev_x
  178.     elsif half_width > $game_player.real_x * one_tile_size
  179.       rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
  180.       x += rev_x
  181.     elsif half_width > rest_width
  182.       rev_x = -((half_width - rest_width) / 128)
  183.       x += rev_x
  184.     end
  185.     half_height = self.contents.height * 128 / 2
  186.     rest_height = ($game_map.height * 128 - $game_player.real_y) * one_tile_size
  187.     rev_y = 0
  188.     if @all_map.height < self.contents.height
  189.       rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
  190.       rev_y -= (self.contents.height - @all_map.height) / 2
  191.       y += rev_y
  192.     elsif half_height > $game_player.real_y * one_tile_size
  193.       rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
  194.       y += rev_y
  195.     elsif half_height > rest_height
  196.       rev_y = -((half_height - rest_height) / 128)
  197.       y += rev_y
  198.     end
  199.     src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
  200.     self.contents.blt(0, 0, @all_map, src_rect)
  201.     if PLAN_Map_Window::WINDOW_MOVE == true
  202.       w = self.x..self.x + self.width
  203.       h = self.y..self.y + self.height
  204.       if w === $game_player.screen_x and h === $game_player.screen_y
  205.         if self.x == PLAN_Map_Window::WIN_X and self.y == PLAN_Map_Window::WIN_Y
  206.           self.x = PLAN_Map_Window::OVER_X
  207.           self.y = PLAN_Map_Window::OVER_Y
  208.         else
  209.           self.x = PLAN_Map_Window::WIN_X
  210.           self.y = PLAN_Map_Window::WIN_Y
  211.         end
  212.       end
  213.     end
  214.     if $game_party.actors.size > 0
  215.       for i in [2, 1, 0]
  216.         tile = @map_data[$game_player.x, $game_player.y, i]
  217.         next if tile == 0
  218.         return if $game_map.priorities[tile] > 0
  219.       end
  220.       actor = $game_party.actors[0]
  221.       bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  222.       width = bitmap.width / 4
  223.       height = bitmap.height / 4
  224.       src_rect = Rect.new(0, 0, width, height)
  225.       w = width / PLAN_Map_Window::ZOOM
  226.       h = height / PLAN_Map_Window::ZOOM
  227.       x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
  228.       y = self.contents.height / 2 - h / 2 - rev_y
  229.       dest_rect = Rect.new(x, y, w, h)
  230.       self.contents.stretch_blt(dest_rect, bitmap, src_rect)
  231.     end
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # ● 更新
  235.   #--------------------------------------------------------------------------
  236.   def update
  237.     super
  238.     if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
  239.       @old_real_x = $game_player.real_x
  240.       @old_real_y = $game_player.real_y
  241.       refresh
  242.     end
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● 解放
  246.   #--------------------------------------------------------------------------
  247.   def dispose
  248.     super
  249.     @all_map.dispose
  250.   end
  251. end
  252.  
  253. #==============================================================================
  254. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  255. #==============================================================================





@弗雷德    结贴,放弃这个功能了,

Lv1.梦旅人

幻想天神

梦石
0
星屑
55
在线时间
166 小时
注册时间
2012-3-24
帖子
404
2
发表于 2013-9-19 16:22:23 | 只看该作者
小地图脚本应该是适用于四方向的吧,把脚本发来,看看能不能改。
我建议改成别的图片,比如一个红点,在同一个游戏,同时加载两个行走图(地图的和小地图的)太耗费资源。

点评

已发脚本,麻烦你了  发表于 2013-9-19 18:36
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
3
 楼主| 发表于 2013-9-19 17:06:55 手机端发表。 | 只看该作者
风若·飘絮 发表于 2013-9-19 16:22
小地图脚本应该是适用于四方向的吧,把脚本发来,看看能不能改。
我建议改成别的图片,比如一个红点,在同 ...

现在上班中,回去用电脑发脚本给你
先谢谢了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
4
 楼主| 发表于 2013-9-23 21:54:46 | 只看该作者
这个没人来帮忙下么?





   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 01:36

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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