设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 117|回复: 0

[转载发布] Map Browsing Navigation

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 16:56:12 | 显示全部楼层 |阅读模式
    Map Browsing Navigation
    Xane


    Versions
    Latest Build: 1.5
    Spoiler: History
                    Ruby:       
    1. #  Update Log (U - Unreleased | R - Released):
    2. #  1.0(R) - Wrote original version of script.
    3. #  1.1(U) - Added map effects and sprite viewings back in.
    4. #  1.2(U) - Fixed a few bugs.
    5. #  1.3(R) - Rewrote script to use data already provided by RM rather then
    6. #           trying to collect new data. Script will now properly update
    7. #           event data, weather effects, and any pictures display originally
    8. #           in Scene_Map.
    9. #  1.4(R) - Fixed typo error with variable. Added check for display coordinates
    10. #           to check for map edges when maps do not loop.
    11. #  1.5(R) - Fixed some more syntax typos and fixed the check for the display coordinates
    复制代码


    Introduction
    Wrote this in response to a script request in the sub forum found here. It has all the bells and whistles of your map but allows you to explore it kind of like in Super Mario World when you press 'select' and the arrows appear on the screen letting you navigate to look around the world.

    Features
    - Explore the given map with a single script call.
    - Weather Effects, Pictures, Events, the Player, and other map effects still will show while navigating.
    - Has a couple of configure options that let you change the navigation speed, arrow usage, displaying text etc.
    - Excellent memory management. This doesn't take pictures of the map and make files, it's all rendered in-engine
      like any other map so you don't have to worry about lag even if you're exploring a map as big as 500x500.

    Screenshots
    None. It's still just whatever map you're on.

    How to use
    This script is plug-in-play. If you want to access the scene, use the script call "(SceneManager.call(Scene_MapNav)" without quotes in an event or via the main menu if you have another script installed that allows custom commands such as Yanfly's Menu.

    Bug Reporting, Compatibility, and Reporting
    Spoiler: Please Review
                    Ruby:       
    1. #   Report all bugs to me on the RM forums. Any version prior to the current
    2. #   version is not supported. All bugs steaming from user changes such as
    3. #   modification of code will not be supported. Any compatibility patches
    4. #   will be provided at my own accord and are not guaranteed in any way.
    复制代码


    Terms and Conditions
    Spoiler: Please Review
                    Ruby:       
    1. #  Retain this header at all times and do not release any new revisions online
    2. #  without prior consent. You may modify the code below at your own discretion
    3. #  but only for private usage. This script may be used both Non Commercially
    4. #  and Commercially with credit provided.
    复制代码


    Credits
    Just place Xane in your credits somewhere. If it's commercial how about a copy?

    Script
    Spoiler: Grab it while it's hot!
                    Ruby:       
    1. #==============================================================================
    2. #  Script      : Map Navigation
    3. #  Author      : Xane
    4. #  Build       : v1.5
    5. #  Created On  : 12.17.2020
    6. #  Last Update : 12.19.2020
    7. #------------------------------------------------------------------------------
    8. #  Terms and Conditions:
    9. #  Retain this header at all times and do not release any new revisions online
    10. #  without prior consent. You may modify the code below at your own discretion
    11. #  but only for private usage. This script may be used both Non Commercially
    12. #  and Commercially with credit provided.
    13. #------------------------------------------------------------------------------
    14. #  Bugs, Compatibility, and Reporting:
    15. #   Report all bugs to me on the RM forums. Any version prior to the current
    16. #   version is not supported. All bugs steaming from user changes such as
    17. #   modification of code will not be supported. Any compatibility patches
    18. #   will be provided at my own accord and are not guaranteed in any way.
    19. #------------------------------------------------------------------------------
    20. #  Update Log (U - Unreleased | R - Released):
    21. #  1.0(R) - Wrote original version of script.
    22. #  1.1(U) - Added map effects and sprite viewings back in.
    23. #  1.2(U) - Fixed a few bugs.
    24. #  1.3(R) - Rewrote script to use data already provided by RM rather then
    25. #           trying to collect new data. Script will now properly update
    26. #           event data, weather effects, and any pictures display originally
    27. #           in Scene_Map.
    28. #  1.4(R) - Fixed typo error with variable. Added check for display coordinate
    29. #           to check for map edges when maps do not loop.
    30. #  1.5(R) - Fixed some more syntax typos and fixed the check for the display coordinates
    31. #------------------------------------------------------------------------------
    32. #  Usage:
    33. #  This script is plug-in-play. If you want to access the scene, use the script
    34. #  call "(SceneManager.call(Scene_MapNav)" without quotes in an event or via
    35. #  the main menu if you have another script installed that allows custom
    36. #  commands such as Yanfly's Menu.
    37. #==============================================================================
    38. #==============================================================================
    39. #  ** Xane_MapNavSettings
    40. #------------------------------------------------------------------------------
    41. #  This module handles various settings. New versions may add more settings.
    42. #==============================================================================
    43. module Xane_MapNavSettings
    44.   # Controls how fast you want to move around the map.
    45.   # Use a float point to adjust this setting. The max speed is 1.0
    46.   Nav_Speed = 0.4
    47.   # Set the text to be displayed on the screen.
    48.   # You'll have a max width of 272 pixels to show a string. Consider this
    49.   # when choosing what the message will display.
    50.   Display_Text = 'Press ESC to return'
    51.   # Displays arrows on screen for visual feedback.
    52.   # Arrows use a single image stored inside your 'Graphics/System' folder.
    53.   # The script will then create copies and map them to the edges of the game
    54.   # window. You can also turn off visual feedback if you wish as well as set
    55.   # the value for a 'blink' effect if you want more flare.
    56.   Use_Nav_Arrows = true
    57.   Use_Nav_Blink_Effect = true
    58.   Nav_Arrow_Image = 'Nav_Arrow'
    59. end
    60. #==============================================================================
    61. # ** Scene_MapNav
    62. #------------------------------------------------------------------------------
    63. #  This scene allows the player to have a viewing of the map as well as its
    64. # events across the map by scrolling around.
    65. #==============================================================================
    66. class Scene_MapNav < Scene_MenuBase
    67.   #--------------------------------------------------------------------------
    68.   # * Included Modules
    69.   #--------------------------------------------------------------------------
    70.   include Xane_MapNavSettings
    71.   #--------------------------------------------------------------------------
    72.   # * Start Processing
    73.   #--------------------------------------------------------------------------
    74.   def start
    75.     super
    76.     @last_display_x = $game_map.display_x
    77.     @last_display_y = $game_map.display_y
    78.     @display_x = @last_display_x
    79.     @display_y = @last_display_y
    80.     @blink_count = 0
    81.     @speed = [[Nav_Speed, 1.0].min, 0].max
    82.     create_all_sprites
    83.     $game_map.refresh
    84.   end
    85.   #--------------------------------------------------------------------------
    86.   # * Create All Sprites
    87.   #--------------------------------------------------------------------------
    88.   def create_all_sprites
    89.     @spriteset = Spriteset_Map.new
    90.     @text_display = Sprite.new
    91.     @text_display.bitmap = Bitmap.new(272, 48)
    92.     @text_display.bitmap.draw_text(@text_display.bitmap.rect, Display_Text, 1)
    93.     return unless Use_Nav_Arrows
    94.     @nav_arrows = Sprite.new
    95.     @nav_arrows.bitmap = Cache.system(Nav_Arrow_Image)
    96.   end
    97.   #--------------------------------------------------------------------------
    98.   # * Frame Update
    99.   #--------------------------------------------------------------------------
    100.   def update
    101.     super
    102.     $game_map.update
    103.     update_navigation
    104.     update_all_sprites
    105.     if Input.trigger?(:B) or Input.trigger?(:C)
    106.       SceneManager.return
    107.     end
    108.   end
    109.   #--------------------------------------------------------------------------
    110.   # * Update Navigation
    111.   #--------------------------------------------------------------------------
    112.   def update_navigation
    113.     @display_x -= @speed if Input.press?(:LEFT) && !Input.press?(:RIGHT)
    114.     @display_x += @speed if Input.press?(:RIGHT) && !Input.press?(:LEFT)
    115.     @display_y -= @speed if Input.press?(:UP) && !Input.press?(:DOWN)
    116.     @display_y += @speed if Input.press?(:DOWN) && !Input.press?(:UP)
    117.     @display_x = [0, [@display_x, $game_map.width - $game_map.screen_tile_x].min].max unless $game_map.loop_horizontal?
    118.     @display_y = [0, [@display_y, $game_map.height - $game_map.screen_tile_y].min].max unless $game_map.loop_vertical?
    119.     $game_map.set_display_pos(@display_x, @display_y)
    120.   end
    121.   #--------------------------------------------------------------------------
    122.   # * Update Sprites
    123.   #--------------------------------------------------------------------------
    124.   def update_all_sprites
    125.     @spriteset.update
    126.     @text_display.update
    127.     return unless Use_Nav_Arrows
    128.     @nav_arrows.update
    129.     return unless Use_Nav_Blink_Effect
    130.     @blink_count = (@blink_count + 1) % 40
    131.     @nav_arrows.opacity = 255 if @blink_count < 20
    132.     @nav_arrows.opacity = 0 if @blink_count >= 20
    133.   end
    134.   #--------------------------------------------------------------------------
    135.   # * Termination Processing
    136.   #--------------------------------------------------------------------------
    137.   def terminate
    138.     super
    139.     dispose_all_sprites
    140.     $game_map.set_display_pos(@last_display_x, @last_display_y)
    141.     dispose_variables
    142.   end
    143.   #--------------------------------------------------------------------------
    144.   # * Dispose All Sprites
    145.   #--------------------------------------------------------------------------
    146.   def dispose_all_sprites
    147.     @spriteset.dispose
    148.     @text_display.bitmap.dispose unless @text_display.bitmap.disposed?
    149.     @text_display.dispose
    150.     return unless Use_Nav_Arrows
    151.     @nav_arrows.bitmap.dispose unless @nav_arrows.bitmap.disposed?
    152.     @nav_arrows.dispose
    153.   end
    154.   #--------------------------------------------------------------------------
    155.   # * Dispose Variables * Good Coding Practice *
    156.   #   Any @ variable is always stored in ram. This will free it.
    157.   #--------------------------------------------------------------------------
    158.   def dispose_variables
    159.     @last_display_x = nil
    160.     @last_display_y = nil
    161.     @display_x = nil
    162.     @display_y = nil
    163.     @blink_count = nil
    164.     @speed = nil
    165.     @spriteset = nil
    166.     @text_display = nil
    167.     @nav_arrows = nil
    168.   end
    169. end
    复制代码


    Additional Files
    If you're using the arrows, here's a quick sample arrow image. Download it, name it whatever you listed in the settings and place inside 'Graphics/System'.

    Spoiler








    本贴来自国际rpgmaker官方论坛作者:VTS处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/map-browsing-navigation.131168/

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 09:30 , Processed in 0.065874 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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