赞 | 0 |
VIP | 0 |
好人卡 | 110 |
积分 | 1 |
经验 | 24791 |
最后登录 | 2013-6-25 |
在线时间 | 687 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 687 小时
- 注册时间
- 2012-10-29
- 帖子
- 1543
|
本帖最后由 j433463 于 2013-5-2 01:00 编辑
或者您想要这样?是吗:
#encoding:utf-8 #============================================================================== # ■ Window_Variables #------------------------------------------------------------------------------ # 地图上显示变量窗口 #============================================================================== # 在不想要显示的地图备注栏中放上 <NOHPHUB> 就可以隐藏。 #============================================================================== HPHUB_X = 0 #显示变量窗口的 X 座标 HPHUB_Y = 0 #显示变量窗口的 Y 座标 HPHUB_INPUT = :C #切换显示/隐藏按钮, 若不想要按钮切换, 等号右边可以清除, 或改为 nil 或 "" 或 '' class Window_Variables < Window_Base #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def initialize super(0, 0, 350, 250) self.opacity = 0 self.back_opacity = 120 @icon = 0 @variable = 0 @o_hp = 0 refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh rect = Rect.new(0,0,350,250) draw_background(rect) draw_actor_face($game_party.members[0], 10, 20) draw_text(120, line_height * 0 + 30, 80, line_height, Vocab::param(2), 0) draw_text(200, line_height * 0 + 30, 80, line_height, $game_actors[1].param(2), 2) draw_text(120, line_height * 1 + 30, 80, line_height, Vocab::param(3), 0) draw_text(200, line_height * 1 + 30, 80, line_height, $game_actors[1].param(3), 2) end #-------------------------------------------------------------------------- # ● 绘制背景 #-------------------------------------------------------------------------- def draw_background(rect) bitmap = Cache.load_bitmap("Graphics/Pictures/", "001_战士_A") #背景图 rect = Rect.new(0, 0, bitmap.width, bitmap.height) contents.blt(contents_width - bitmap.width, contents_height - bitmap.height, bitmap, rect, 255) bitmap.dispose end end #============================================================================== # ■ Scene_Map #------------------------------------------------------------------------------ # 地图生成窗口 #============================================================================== class Scene_Map < Scene_Base alias new_start start def start new_start @varia_window = Window_Variables.new @varia_window.x = HPHUB_X @varia_window.y = HPHUB_Y @varia_window.visible = false end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- alias new_update update def update new_update #地图备注检查 return if (/<NOHPHUB>/i.match($game_map.note)) != nil #初始值 @show_hp_hud = true if @show_hp_hud == nil #按键切换开/关 if HPHUB_INPUT != nil && HPHUB_INPUT != "" && HPHUB_INPUT != '' if Input.trigger?(HPHUB_INPUT) if @show_hp_hud != true @show_hp_hud = true else @show_hp_hud = false end end end #显示/隐藏执行 if @show_hp_hud == true @varia_window.refresh @varia_window.visible = true else @varia_window.visible = false #close_varia_window end end #-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- alias new_terminate terminate def terminate @varia_window.dispose new_terminate end #-------------------------------------------------------------------------- # ● 关闭 #-------------------------------------------------------------------------- def close_varia_window @varia_window.close update until @varia_window.close? end end #============================================================================== # ■ Game_Map #------------------------------------------------------------------------------ # 管理地图的类。 #============================================================================== class Game_Map #-------------------------------------------------------------------------- # ● 取得地图备注栏 #-------------------------------------------------------------------------- def note @map.note end end
#encoding:utf-8
#==============================================================================
# ■ Window_Variables
#------------------------------------------------------------------------------
# 地图上显示变量窗口
#==============================================================================
# 在不想要显示的地图备注栏中放上 <NOHPHUB> 就可以隐藏。
#==============================================================================
HPHUB_X = 0 #显示变量窗口的 X 座标
HPHUB_Y = 0 #显示变量窗口的 Y 座标
HPHUB_INPUT = :C #切换显示/隐藏按钮, 若不想要按钮切换, 等号右边可以清除, 或改为 nil 或 "" 或 ''
class Window_Variables < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 350, 250)
self.opacity = 0
self.back_opacity = 120
@icon = 0
@variable = 0
@o_hp = 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
rect = Rect.new(0,0,350,250)
draw_background(rect)
draw_actor_face($game_party.members[0], 10, 20)
draw_text(120, line_height * 0 + 30, 80, line_height, Vocab::param(2), 0)
draw_text(200, line_height * 0 + 30, 80, line_height, $game_actors[1].param(2), 2)
draw_text(120, line_height * 1 + 30, 80, line_height, Vocab::param(3), 0)
draw_text(200, line_height * 1 + 30, 80, line_height, $game_actors[1].param(3), 2)
end
#--------------------------------------------------------------------------
# ● 绘制背景
#--------------------------------------------------------------------------
def draw_background(rect)
bitmap = Cache.load_bitmap("Graphics/Pictures/", "001_战士_A") #背景图
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
contents.blt(contents_width - bitmap.width, contents_height - bitmap.height, bitmap, rect, 255)
bitmap.dispose
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 地图生成窗口
#==============================================================================
class Scene_Map < Scene_Base
alias new_start start
def start
new_start
@varia_window = Window_Variables.new
@varia_window.x = HPHUB_X
@varia_window.y = HPHUB_Y
@varia_window.visible = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias new_update update
def update
new_update
#地图备注检查
return if (/<NOHPHUB>/i.match($game_map.note)) != nil
#初始值
@show_hp_hud = true if @show_hp_hud == nil
#按键切换开/关
if HPHUB_INPUT != nil && HPHUB_INPUT != "" && HPHUB_INPUT != ''
if Input.trigger?(HPHUB_INPUT)
if @show_hp_hud != true
@show_hp_hud = true
else
@show_hp_hud = false
end
end
end
#显示/隐藏执行
if @show_hp_hud == true
@varia_window.refresh
@varia_window.visible = true
else
@varia_window.visible = false
#close_varia_window
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
alias new_terminate terminate
def terminate
@varia_window.dispose
new_terminate
end
#--------------------------------------------------------------------------
# ● 关闭
#--------------------------------------------------------------------------
def close_varia_window
@varia_window.close
update until @varia_window.close?
end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
# 管理地图的类。
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● 取得地图备注栏
#--------------------------------------------------------------------------
def note
@map.note
end
end
这是临时用以前写的地图显示HP变量脚本改的,加上背景图,可以用按钮 C 也就是空白键切换显示/隐藏,如果想用别的按钮也可以自己设定。
测试截图:
|
|