Project1
标题:
怎么在装备上显示角色待机图
[打印本页]
作者:
没有马甲
时间:
2011-3-16 13:00
提示:
作者被禁止或删除 内容自动屏蔽
作者:
originalgame
时间:
2011-3-16 16:27
沙发一下,等待解答
作者:
沙漠点灰
时间:
2011-3-16 17:47
把一下代码(紧接)插到Main前
class Window_EquipLeft
alias dust_refresh refresh
def refresh
dust_refresh
draw_actor_graphic(@actor, 150, 48)
end
end
复制代码
好了,测试一下吧
作者:
烁灵
时间:
2011-3-16 20:16
本帖最后由 烁灵 于 2011-3-16 20:17 编辑
记得从前柳柳前辈写过这个东西~
于是借用下沙漠前辈的代码咯~
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
# 作者: 柳柳
#
# 说明:这是功能我再比较早期的时候发布在幻森,不过那时候比较笨,方法很糟糕
# 这次是拿上就可以用的。
#
# 感谢:Claimh的脚本使我想起这个功能重做了一遍,本想直接用他的,不过他的算法过分
# 冗余了,没好意思用。
#==============================================================================
# 使用方法:默认情况下把静态图变为了走步图。如果想自行修改,提供功能如下:
#
# 角色走步图:draw_walk_actor_graphic
# 角色转向图:draw_turn_actor_graphic
#
# 回复原有静态角色图:删除100行以后的内容。修改下面这个变量可以更改行走速度
#==============================================================================
WALK_REFRESH_FRAME_SPEED = 12 # 刷新的速度,越大越慢,你可以改为3左右试试看
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# 初始化方法
#--------------------------------------------------------------------------
alias initialize_walk initialize
def initialize(x, y, width, height)
initialize_walk(x, y, width, height)
@start_walk = false
@turn_index = 0
@turn_phase = 0
end
#--------------------------------------------------------------------------
# ★ 角色行走图
# actor : 角色
# x : 描绘的 X 坐标
# y : 描绘的 Y 坐标
#--------------------------------------------------------------------------
def draw_walk_actor_graphic(actor, x, y)
if actor.hp == 0
bitmap = RPG::Cache.character(actor.character_name+"_d", actor.character_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0,0,cw,ch)
else
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
@start_turn = true
case @turn_phase
when 0
x_x = 0
when 1
x_x = cw
when 2
x_x = cw * 2
when 3
x_x = cw * 3
end
src_rect = Rect.new(x_x, 0, cw, ch)
end
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# ★ 角色转向图
# actor : 角色
# x : 描绘的 X 坐标
# y : 描绘的 Y 坐标
#--------------------------------------------------------------------------
def draw_turn_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
@start_turn = true
case @turn_phase
when 0
x_x = 0
when 1
x_x = ch
when 2
x_x = ch * 3
when 3
x_x = ch * 2
end
src_rect = Rect.new(0, x_x, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# 更新(可别使用刷新,玩命耗费内存= =)
#--------------------------------------------------------------------------
alias walk_update update
def update
walk_update
if @start_turn == true
@turn_index += 1
if @turn_index == WALK_REFRESH_FRAME_SPEED
refresh
@turn_index = 0
@turn_phase = (@turn_phase+1)%4
end
end
end
end
###############################################################
class Window_EquipLeft
alias dust_refresh refresh
def refresh
dust_refresh
draw_walk_actor_graphic(@actor, 150, 48)#原地踏步
#draw_turn_actor_graphic(@actor, 150, 48)#原地转圈
end
end
###############################################################
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1