Project1
标题:
战斗底部我方状态框加上头像
[打印本页]
作者:
柳柳
时间:
2008-1-14 04:57
标题:
战斗底部我方状态框加上头像
应风雪悠游的要求把这个小脚本单独放出,实际上老早年间的录像教学已经教过了,大家都可以自己改。唉,真是的,新工具出了咋不自己动手呢……
代码如下,请自行替换原来的本类代码:
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
# 显示战斗画面同伴状态的窗口。
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 0, 416, 128)
self.contents.font.size = 18
refresh
self.active = false
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.members.size
for i in 0...@item_max
draw_item(i)
end
draw_6Rface(@index) if @index >= 0
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
actor = $game_party.members[index]
draw_actor_name(actor, 124, rect.y + 2)
begin_x = self.contents.text_size(actor.name).width + 4
draw_actor_state(actor, begin_x, rect.y, 24)
draw_actor_hp(actor, 230, rect.y, 65)
draw_actor_mp(actor, 310, rect.y, 65)
end
#--------------------------------------------------------------------------
# ● 描绘人物头像
# index : 项目编号
#--------------------------------------------------------------------------
def draw_6Rface(index)
rect = Rect.new(0, 0, 96, 96)
self.contents.clear_rect(rect)
actor = $game_party.members[index]
draw_actor_face(actor, 0, 0, 96)
end
#--------------------------------------------------------------------------
# ● 设置光标的位置
# index : 新的光标位置
#--------------------------------------------------------------------------
def index=(index)
@index = index
update_cursor
refresh
end
#--------------------------------------------------------------------------
# ● 获取项目描画矩形
# index : 项目编号
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = contents.width - 113
rect.height = WLH
rect.x = 113
rect.y = index / @column_max * WLH
return rect
end
#--------------------------------------------------------------------------
# ● 更新光标矩形
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # 光标位置不满 0 的情况下
self.cursor_rect.empty # 光标无效
else # 光标位 0 以上的情况下
row = @index / @column_max # 获取当前的行
if row < top_row # 当前行被显示开头行前面的情况下
self.top_row = row # 从当前行向开头行滚动
end
if row > bottom_row # 当前行被显示末尾行之后的情况下
self.bottom_row = row # 从当前行向末尾滚动
end
rect = item_rect(@index) # 获取选择项的矩形
rect.y -= self.oy # 矩形滚动的位置加起来
self.cursor_rect = rect # 更新光标矩形
end
end
end
复制代码
作者:
柳柳
时间:
2008-1-14 04:57
标题:
战斗底部我方状态框加上头像
应风雪悠游的要求把这个小脚本单独放出,实际上老早年间的录像教学已经教过了,大家都可以自己改。唉,真是的,新工具出了咋不自己动手呢……
代码如下,请自行替换原来的本类代码:
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
# 显示战斗画面同伴状态的窗口。
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 0, 416, 128)
self.contents.font.size = 18
refresh
self.active = false
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.members.size
for i in 0...@item_max
draw_item(i)
end
draw_6Rface(@index) if @index >= 0
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
actor = $game_party.members[index]
draw_actor_name(actor, 124, rect.y + 2)
begin_x = self.contents.text_size(actor.name).width + 4
draw_actor_state(actor, begin_x, rect.y, 24)
draw_actor_hp(actor, 230, rect.y, 65)
draw_actor_mp(actor, 310, rect.y, 65)
end
#--------------------------------------------------------------------------
# ● 描绘人物头像
# index : 项目编号
#--------------------------------------------------------------------------
def draw_6Rface(index)
rect = Rect.new(0, 0, 96, 96)
self.contents.clear_rect(rect)
actor = $game_party.members[index]
draw_actor_face(actor, 0, 0, 96)
end
#--------------------------------------------------------------------------
# ● 设置光标的位置
# index : 新的光标位置
#--------------------------------------------------------------------------
def index=(index)
@index = index
update_cursor
refresh
end
#--------------------------------------------------------------------------
# ● 获取项目描画矩形
# index : 项目编号
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = contents.width - 113
rect.height = WLH
rect.x = 113
rect.y = index / @column_max * WLH
return rect
end
#--------------------------------------------------------------------------
# ● 更新光标矩形
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # 光标位置不满 0 的情况下
self.cursor_rect.empty # 光标无效
else # 光标位 0 以上的情况下
row = @index / @column_max # 获取当前的行
if row < top_row # 当前行被显示开头行前面的情况下
self.top_row = row # 从当前行向开头行滚动
end
if row > bottom_row # 当前行被显示末尾行之后的情况下
self.bottom_row = row # 从当前行向末尾滚动
end
rect = item_rect(@index) # 获取选择项的矩形
rect.y -= self.oy # 矩形滚动的位置加起来
self.cursor_rect = rect # 更新光标矩形
end
end
end
复制代码
作者:
柳柳
时间:
2008-1-14 05:16
有啊。难道不应该有么?
作者:
face00zz
时间:
2008-1-14 06:35
提示:
作者被禁止或删除 内容自动屏蔽
作者:
叮当
时间:
2008-1-14 16:54
不过那战斗图真是难看
作者:
御灵
时间:
2008-2-12 07:41
发布完毕。
http://rpg.blue/web/htm/news968.htm
作者:
jccg1000466
时间:
2008-2-19 14:23
为什么我使用这脚本之后人物行走只能左右走,下是自动走的,上就没反映了(失效)
这是怎么回事啊!
作者:
jccg1000466
时间:
2008-2-19 14:26
难道我用错脚本了?
作者:
光郎
时间:
2008-2-19 14:51
重新启动电脑。机子问题。
作者:
风雪优游
时间:
2008-2-20 05:36
以下引用
柳柳于2008-1-13 20:57:46
的发言:
应风雪悠游的要求把这个小脚本单独放出,实际上老早年间的录像教学已经教过了,大家都可以自己改。唉,真是的,新工具出了咋不自己动手呢……
那啥,脚本不贵在复杂,而贵在实用~~~
受教了~因为我脚本盲嘛~~~~而且主要我觉得时间要集中在自己擅长的方面~
作者:
逐月
时间:
2008-2-20 17:23
提示:
作者被禁止或删除 内容自动屏蔽
作者:
coolmic
时间:
2008-3-12 16:59
这个脚本有一个缺点~就是如果队员使用恢复魔法或辅助魔法~底下的头像永远都是第一主人公...~
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1