查看: 58|回复: 0

[转载发布] 小地图脚本(mini map with out bitmap file)

[复制链接]
  • TA的每日心情
    开心
    7 天前
  • 签到天数: 37 天

    连续签到: 3 天

    [LV.5]常住居民I

    2028

    主题

    32

    回帖

    7260

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    0
    卡币
    5184
    OK点
    16
    积分
    7260
    发表于 同元一千年七月二十八日(秋) | 显示全部楼层 |阅读模式
    give me the credit if you can!

    1.5 脚本 的 Screen shot:


    用法:
    To set the type of blip in the map:
    让一个 event 变成在小地图上的 Enemy,将事件添加一个注释,内容为 "enemy"
    让一个 event 变成在小地图上的 Event,将事件添加桓鲎⑹停?谌菸?"event"
    让一个 event 变成在小地图上的 allied (or NPC),将事件添加一个注释,内容为 "allied"
    让一个 event 变成在小地图上的 SavePoint,将事件添加一个注释,内容为 "savepoint"
    让一个 event 变成在小地图上的 Teleport,将事件添加一个注释,内容为 "teleport"
    让一个 event 变成在小地图上的 Chest,将事件添加一个注释,内容为 "chest"

    自己改这些
    1. #--------------------------------------------------------------------------class Game_System  attr_accessor :minimap_visible    attr_accessor :minimap_corner  alias initialize_minimap initialize  def initialize    @minimap_visible = true   # 一开始就显示小地图    @minimap_corner = 1       # 小地图的位置 (1,2,3,4)    initialize_minimap  endend复制代码
    复制代码


    在运行时改变小地图
    显示小地图
    $game_system.minimap_visible = true

    不显示小地图
    $game_system.minimap_visible = false

    换位置
    $game_system.minimap_corner = 1 # 2, 3, 4

    使用自己的 border, 必须改变一些 (在 Spriteset_MiniMap 内)
    1. bt = 25  # the border size at the top bl = 5  # the border size at the leftbr = 5  # the border size at the rightbb= 5    # the border size at the bottom复制代码
    复制代码


    脚本在楼下。
    有一些词语我不会翻译,大家可以帮我改吗?

    [Ruby] 纯文本查看 复制代码
    #==============================================================================
    # * Spriteset_MiniMap ver 1.5
    #------------------------------------------------------------------------------
    # Fanha Giang, 2005/11/18
    #==============================================================================
    
    class Spriteset_MiniMap
      def initialize()
        @zoom = 0.25
        @size = 32
        @dsize = @size * @zoom
        @coner = $game_system.minimap_corner
       
        # the viewport for the mini map and the blips
        @viewport = Viewport.new(0, 0, 640, 480)
        @viewport.z = 6000
    
        # sprite of minimap
        @minimap = Sprite_MiniMap.new(@viewport, @dsize)   
    
        # bitmap of the minimap
        @bitmap = Bitmap.new($game_map.width * @dsize, $game_map.height * @dsize)   
       
        # drawer object
        @draw_minimap = Draw_MiniBitmap.new(0, @bitmap, 28, 23)
        @draw_minimap.map_data = $game_map.data
        @draw_minimap.priorities = $game_map.priorities
        @draw_minimap.tileset = RPG::Cache.tileset($game_map.tileset_name)
        for i in 0..6
          @draw_minimap.autotiles[i] = RPG::Cache.autotile($game_map.autotile_names[i])
        end
    
        # the blips in the map
        @mini_sprites = []
        for event in $game_map.events.values
          @mini_sprites.push(Sprite_Mini_Character.new(@viewport, @zoom, 1 , event))
        end        
        @mini_sprites.push(Sprite_Mini_Character.new(@viewport, @zoom, 0, $game_player))
    
        # viewport of the border and something else addon
        @bviewport = Viewport.new(0, 0, 640, 480)
        @bviewport.z = 6001
       
        # init the border
        @border = Sprite.new(@bviewport)
        @border.bitmap = RPG::Cache.picture("border")
    
        # init the map name
        @mapname = Sprite.new(@bviewport)
        @mapname.x = 30
        @mapname.y = 3
        @mapname.bitmap = Bitmap.new(200,25)
        @mapname.bitmap.font.name = "Tahoma"
        @mapname.bitmap.font.size = 21
        @mapname.bitmap.font.color = Color.new(255, 0, 0, 255)
        @mapname.bitmap.draw_text(@mapname.bitmap.rect, $game_map.name.to_s, 1)
    
        update_viewport   
        update
      end
      #--------------------------------------------------------------------------
      # - Release
      #--------------------------------------------------------------------------
      def dispose
        # dispose the bitmap
        (!@bitmap.nil?) ? @bitmap.dispose : nil
        # dispose the mini map sprite
        @minimap.dispose
        # dispose the blips
        for sprite in @mini_sprites
          sprite.dispose
        end
        # dispose the map name
        @mapname.bitmap.dispose
        @mapname.dispose
        #dispose the border
        @border.bitmap.dispose
        @border.dispose   
        # dispose the viewport
        @viewport.dispose
        @bviewport.dispose
      end
      #--------------------------------------------------------------------------
      # - Frame renewal
      #--------------------------------------------------------------------------
      def update
        # draw the map
        x1 = (($game_map.display_x - 64) / 128 - 4).to_i
        y1 = ($game_map.display_y / 128 - 4).to_i
        @draw_minimap.draw(x1,y1)
       
        # update the sprites
        @minimap.update(@bitmap)
        for sprite in @mini_sprites
          sprite.update
        end
    
        if  @coner != $game_system.minimap_corner
          @coner = $game_system.minimap_corner
          update_viewport
        end   
          
        @viewport.visible = $game_system.minimap_visible
        @bviewport.visible = $game_system.minimap_visible
      end
    #--------------------------------------------------------------------------
      def update_viewport
        width = (640 + @size * 4) * @zoom
        height = (480 + @size * 4) * @zoom
        bt = 25
        bl = 39
        br = 39
        bb= 5
        case $game_system.minimap_corner
          when 1
            @viewport.rect.set(0 + bl, 0 + bt, width, height)
            @bviewport.rect.set(0 , 0 , width + bl + br, height + bt + bb)
          when 2
            @viewport.rect.set(640 - width - br, 0 + bt, width, height)
            @bviewport.rect.set(640 - width - br - bl, 0 , width + bl + br, height + bt + bb)
          when 3
            @viewport.rect.set(0 + bl, 480 - height - bb, width, height)
            @bviewport.rect.set(0 , 480 - height - bb - bt , width + bl + br, height + bt + bb)
          when 4
            @viewport.rect.set(640 - width  - br, 480 - height - bb, width, height)        
            @bviewport.rect.set(640 - width - br - bl , 480 - height - bb - bt , width + bl + br, height + bt + bb)
        end
      end  
    #---------------------------------------------------------------------------------------
    end
    
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------  
    class Game_System
      attr_accessor :minimap_visible      # to set the minimap visible or not
      attr_accessor :minimap_corner      # to set the corner of the minimap 1, 2, 3, 4
      alias initialize_minimap initialize
      def initialize
        @minimap_visible = false
        @minimap_corner = 1
        initialize_minimap
      end
    end
    #--------------------------------------------------------------------------  
    #--------------------------------------------------------------------------  
    class Game_Map
      # add by the script mini map of Fanha Giang
      def name
        text = $map_infos[@map_id].clone
        text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
          $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
        end
        return text
      end
      # end of the add by Fanha Giang
    end
    #--------------------------------------------------------------------------  
    #--------------------------------------------------------------------------  
    class Scene_Title
      # add by the script mini map of Fanha Giang
      def load_map_infos
        $map_infos = load_data("Data/MapInfos.rxdata")
        for key in $map_infos.keys
          $map_infos[key] = $map_infos[key].name
        end   
      end  
      # end add
    end
    #--------------------------------------------------------------------------  
    #--------------------------------------------------------------------------  



                 本帖来自P1论坛作者Fanha99,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg. blue/forum.php?mod=viewthread&tid=2321  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
    天天去同能,天天有童年!
    回复 论坛版权

    使用道具 举报

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

    本版积分规则

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2024-5-17 23:28 , Processed in 0.076400 second(s), 46 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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