Project1
标题:
自制的ARPG人物窗口无法监控状态变化的问题
[打印本页]
作者:
未知的赞歌
时间:
2007-7-31 05:18
标题:
自制的ARPG人物窗口无法监控状态变化的问题
以下脚本是我根据主站上的范例修改而来的,
#===============================================================================
# ■ Window_MapStatus
#-------------------------------------------------------------------------------
# 在地图上显示的状态窗口
#===============================================================================
class Window_MapStatus < Window_Base
attr_accessor :actor # 当前角色
#-----------------------------------------------------------------------------
# ● 初始化
#-----------------------------------------------------------------------------
def initialize
super(0,0,160,100)
self.contents=Bitmap.new(width,height)
self.back_opacity=0
self.contents.font.size=14
self.visible = false
self.windowskin=nil
unless $game_party.actors.size<1
@actor=$game_party.actors[0]
@last_actor=@actor
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
_s
@
[email protected]
@last_vis=self.visible
self.visible = true
refresh
end
end
#-----------------------------------------------------------------------------
# ● 刷新画面
#-----------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic2(actor)
draw_actor_name(actor, 40, -10)
draw_actor_hp(actor, 40, 4, 88)
draw_actor_sp(actor, 40, 18, 88)
draw_actor_exp(actor,40,30,88)
draw_actor_state(actor, 40, 46)
end
#-----------------------------------------------------------------------------
# ● 更新
#-----------------------------------------------------------------------------
def update
super
if self.changed?
refresh
end
end
#----------------------------------------------------------------------------
# ● 改变标志
#----------------------------------------------------------------------------
def changed?
c = false
if (@actor != @last_actor or @actor.hp != @last_hp or @actor.sp != @last_sp or
@actor.maxhp != @last_maxhp or @actor.maxsp != @last_maxsp or (@last_vis != true and self.visible ==true) or
@actor.level != @last_level or @actor.exp_s != @last_exp_s or @actor.states != @last_states)
c = true
@last_actor=@actor
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
_s
@
[email protected]
@last_vis=self.visible
end
return c
end
#----------------------------------------------------------------------------
# ● 专用绘图
#----------------------------------------------------------------------------
def draw_actor_graphic2(actor)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / $c3_每一步的帧数
ch = bitmap.height / $c3_总共可用的方向数
src_rect = Rect.new(0, 0, cw, ch)
dest_rect = Rect.new(-8, 0, 42, 74)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
end
end
复制代码
但使用时,却出现了让人郁闷的问题:当hp或sp变化时可以在窗口中反映出来,而状态变化时却无法在窗口中反映出来。看了半天,愣是没看出来是为什么,只能上论坛求助了。还请各位高手帮帮忙,不胜感激。
作者:
未知的赞歌
时间:
2007-7-31 05:18
标题:
自制的ARPG人物窗口无法监控状态变化的问题
以下脚本是我根据主站上的范例修改而来的,
#===============================================================================
# ■ Window_MapStatus
#-------------------------------------------------------------------------------
# 在地图上显示的状态窗口
#===============================================================================
class Window_MapStatus < Window_Base
attr_accessor :actor # 当前角色
#-----------------------------------------------------------------------------
# ● 初始化
#-----------------------------------------------------------------------------
def initialize
super(0,0,160,100)
self.contents=Bitmap.new(width,height)
self.back_opacity=0
self.contents.font.size=14
self.visible = false
self.windowskin=nil
unless $game_party.actors.size<1
@actor=$game_party.actors[0]
@last_actor=@actor
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
_s
@
[email protected]
@last_vis=self.visible
self.visible = true
refresh
end
end
#-----------------------------------------------------------------------------
# ● 刷新画面
#-----------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic2(actor)
draw_actor_name(actor, 40, -10)
draw_actor_hp(actor, 40, 4, 88)
draw_actor_sp(actor, 40, 18, 88)
draw_actor_exp(actor,40,30,88)
draw_actor_state(actor, 40, 46)
end
#-----------------------------------------------------------------------------
# ● 更新
#-----------------------------------------------------------------------------
def update
super
if self.changed?
refresh
end
end
#----------------------------------------------------------------------------
# ● 改变标志
#----------------------------------------------------------------------------
def changed?
c = false
if (@actor != @last_actor or @actor.hp != @last_hp or @actor.sp != @last_sp or
@actor.maxhp != @last_maxhp or @actor.maxsp != @last_maxsp or (@last_vis != true and self.visible ==true) or
@actor.level != @last_level or @actor.exp_s != @last_exp_s or @actor.states != @last_states)
c = true
@last_actor=@actor
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
@
[email protected]
_s
@
[email protected]
@last_vis=self.visible
end
return c
end
#----------------------------------------------------------------------------
# ● 专用绘图
#----------------------------------------------------------------------------
def draw_actor_graphic2(actor)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / $c3_每一步的帧数
ch = bitmap.height / $c3_总共可用的方向数
src_rect = Rect.new(0, 0, cw, ch)
dest_rect = Rect.new(-8, 0, 42, 74)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
end
end
复制代码
但使用时,却出现了让人郁闷的问题:当hp或sp变化时可以在窗口中反映出来,而状态变化时却无法在窗口中反映出来。看了半天,愣是没看出来是为什么,只能上论坛求助了。还请各位高手帮帮忙,不胜感激。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1