Project1

标题: 怎样在游戏左下角添加坐标? [打印本页]

作者: 幻の音    时间: 2010-8-13 14:40
提示: 作者被禁止或删除 内容自动屏蔽
作者: wangswz    时间: 2010-8-13 15:55
搜索
作者: 小鱼子    时间: 2010-8-13 16:31
这个……
用了之后可能会影响系统速度……
作者: 水镜风生    时间: 2010-8-13 16:43
并行处理的公共事件。【变量】【条件分歧】【显示图片】,完全可以不用脚本。
作者: 小鱼子    时间: 2010-8-13 16:47
本帖最后由 小鱼子 于 2010-8-13 16:48 编辑

这个不是在右下角,但是你自己调吧(我没时间)
  1. #==============================================================================
  2. # ■ Window_Pos
  3. #==============================================================================

  4. class Window_Pos < Window_Base
  5. #--------------------------------------------------------------------------
  6. # ● 初始化
  7. #--------------------------------------------------------------------------
  8. def initialize
  9.    super(0, 0, 122, 52)
  10.    self.z = 151
  11.    self.contents.font.size = 20
  12.    refresh
  13. end
  14. #--------------------------------------------------------------------------
  15. # ● 刷新
  16. #--------------------------------------------------------------------------
  17. def refresh
  18.    self.contents.clear
  19.    self.contents.font.color = system_color
  20.    @x,@y = $game_player.x,$game_player.y
  21.    self.contents.draw_text(0, 0, 90, 20, "(#{@x},#{@y})", 1)
  22. end
  23. #--------------------------------------------------------------------------
  24. # ● 更新
  25. #--------------------------------------------------------------------------
  26. def update
  27.    return if $game_player.x == @x and $game_player.y == @y
  28.    refresh
  29. end
  30. end

  31. #==============================================================================
  32. # ■ Window_MapName
  33. #==============================================================================

  34. class Window_MapName < Window_Base
  35. #--------------------------------------------------------------------------
  36. # ● 初始化
  37. #--------------------------------------------------------------------------
  38. def initialize
  39.    @map_id = $game_map.map_id
  40.    super(0, 0, 182, 52)
  41.    self.contents.font.size = 20
  42.    self.z = 151
  43.    refresh
  44. end
  45. #--------------------------------------------------------------------------
  46. # ● 刷新
  47. #--------------------------------------------------------------------------
  48. def refresh
  49.    self.opacity = 255
  50.    self.contents_opacity = 255
  51.    name = $data_mapinfos[@map_id].name
  52.    width = self.contents.text_size(name).width
  53.    height = self.contents.text_size(name).height
  54.    self.width = width + 32
  55.    self.height = height + 32
  56.    self.contents = Bitmap.new(width, height)
  57.    self.contents.font.size = 20
  58.    self.x = (Graphics.width - self.width) / 2
  59.    self.y = (Graphics.height - self.height) / 2
  60.    self.contents.font.color = system_color
  61.    self.contents.draw_text(0, 0, width, 20, name, 1)
  62. end
  63. #--------------------------------------------------------------------------
  64. # ● 更新
  65. #--------------------------------------------------------------------------
  66. def update
  67.    if $game_map.map_id != @map_id
  68.      @map_id = $game_map.map_id
  69.      refresh
  70.      self.opacity = 255
  71.      self.contents_opacity = 255
  72.    end
  73.    return if self.opacity == 0
  74.    self.opacity -= 3
  75.    self.contents_opacity -= 3
  76. end

  77. end

  78. class Scene_Title < Scene_Base
  79. #--------------------------------------------------------------------------
  80. # ● 数据库载入
  81. #--------------------------------------------------------------------------
  82. alias old_ld load_database
  83. def load_database
  84.    old_ld
  85.    $data_mapinfos       = load_data("Data/MapInfos.rvdata")
  86. end
  87. end

  88. class Scene_Map < Scene_Base
  89. #--------------------------------------------------------------------------
  90. # ● 开始
  91. #--------------------------------------------------------------------------
  92. alias old_start start
  93. def start
  94.    old_start
  95.    @pos_window = Window_Pos.new
  96.    @mapname_window = Window_MapName.new
  97. end
  98. #--------------------------------------------------------------------------
  99. # ● 结束
  100. #--------------------------------------------------------------------------
  101. alias old_ter terminate
  102. def terminate
  103.    old_ter
  104.    @pos_window.dispose
  105.    @mapname_window.dispose
  106. end
  107. #--------------------------------------------------------------------------
  108. # ● 更新
  109. #--------------------------------------------------------------------------
  110. alias old_update update
  111. def update
  112.    old_update
  113.    @pos_window.update
  114.    @mapname_window.update
  115. end
  116. end
复制代码

作者: mile上校    时间: 2010-8-13 22:28
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1