赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2853 |
最后登录 | 2019-1-8 |
在线时间 | 107 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 144
- 在线时间
- 107 小时
- 注册时间
- 2012-5-16
- 帖子
- 69
|
j433463 发表于 2013-5-2 01:58
不好意思,刚才被自己一个小失误,搞得测试半天都不能正常切换,后来才发现是事件中开关指定错了,一场乌龙 ...
有问题出现呢,这个是怎么回事呢??
我把金钱的值draw到这里,本来游戏默认是0元,后来我同过某个事件添加了金钱,这个0依然存在,只是在上面加了501三个数字而已。
包括hp、mp这些值都是同样情况
麻烦帮忙看看是不是我改代码时改出了问题?
#encoding:utf-8 #============================================================================== # ■ Window_Variables #------------------------------------------------------------------------------ # 地图上显示变量窗口 #============================================================================== HPHUB_X = 100 #显示变量窗口的 X 座标 HPHUB_Y = 0 #显示变量窗口的 Y 座标 HPHUB_SWITCH = 100 #切换 显示 / 隐藏 窗口的开关ID class Window_Variables < Window_Base #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def initialize super(100, 120, 740, 600) self.opacity = 0 #self.back_opacity = 120 refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh draw_background draw_actor_name($game_actors[1], 330, 140) draw_actor_nickname($game_actors[1], 300, 210) draw_actor_level($game_actors[1], 330, 177) draw_actor_exp($game_actors[1], 520, 177) draw_actor_param($game_actors[1], 230, 335, 0) draw_actor_param($game_actors[1], 230, 304, 1) draw_actor_param($game_actors[1], 230, 245, 2) draw_actor_param($game_actors[1], 230, 275, 3) draw_actor_param($game_actors[1], 230, 364, 4) draw_actor_param($game_actors[1], 230, 395, 5) draw_actor_param($game_actors[1], 230, 426, 6) draw_actor_param($game_actors[1], 230, 455, 7) draw_actor_hp($game_actors[1], 430, 455) draw_actor_mp($game_actors[1], 430, 485) change_color(text_color(6)) draw_text(250, 385, 300, 300,$game_party.gold, 2) end #-------------------------------------------------------------------------- # ● 绘制背景 #-------------------------------------------------------------------------- def draw_background bitmap = Cache.picture("plain") #背景图 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 @show_hp_hud == $game_switches[HPHUB_SWITCH] p $game_switches[HPHUB_SWITCH].to_s + "=>" + @show_hp_hud.to_s if $game_switches[HPHUB_SWITCH] != true @show_hp_hud = false else @show_hp_hud = true 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
#encoding:utf-8
#==============================================================================
# ■ Window_Variables
#------------------------------------------------------------------------------
# 地图上显示变量窗口
#==============================================================================
HPHUB_X = 100 #显示变量窗口的 X 座标
HPHUB_Y = 0 #显示变量窗口的 Y 座标
HPHUB_SWITCH = 100 #切换 显示 / 隐藏 窗口的开关ID
class Window_Variables < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(100, 120, 740, 600)
self.opacity = 0
#self.back_opacity = 120
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
draw_background
draw_actor_name($game_actors[1], 330, 140)
draw_actor_nickname($game_actors[1], 300, 210)
draw_actor_level($game_actors[1], 330, 177)
draw_actor_exp($game_actors[1], 520, 177)
draw_actor_param($game_actors[1], 230, 335, 0)
draw_actor_param($game_actors[1], 230, 304, 1)
draw_actor_param($game_actors[1], 230, 245, 2)
draw_actor_param($game_actors[1], 230, 275, 3)
draw_actor_param($game_actors[1], 230, 364, 4)
draw_actor_param($game_actors[1], 230, 395, 5)
draw_actor_param($game_actors[1], 230, 426, 6)
draw_actor_param($game_actors[1], 230, 455, 7)
draw_actor_hp($game_actors[1], 430, 455)
draw_actor_mp($game_actors[1], 430, 485)
change_color(text_color(6))
draw_text(250, 385, 300, 300,$game_party.gold, 2)
end
#--------------------------------------------------------------------------
# ● 绘制背景
#--------------------------------------------------------------------------
def draw_background
bitmap = Cache.picture("plain") #背景图
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 @show_hp_hud == $game_switches[HPHUB_SWITCH]
p $game_switches[HPHUB_SWITCH].to_s + "=>" + @show_hp_hud.to_s
if $game_switches[HPHUB_SWITCH] != true
@show_hp_hud = false
else
@show_hp_hud = true
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
|
|