加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 baidubb2733 于 2015-9-25 23:45 编辑
我想要的效果是,在菜单状态窗口中,用图片代表在队的角色,当选中某个角色时他的图片会变为另外一张,(相当于按钮的效果)。
我自己改的menustatus是这样的,现在能将这些图片摆在窗口中,但是因为用for添加的图片,不知道怎么修改单张图片的透明度,请问怎样写选中就能换图片的脚本呢?
刚开始学脚本,非常小白,好焦急,头像代表我的心情,跪求各位大神教教我。
#============================================================================== # ■ Window_MenuStatus #------------------------------------------------------------------------------ # 显示菜单画面和同伴状态的窗口。 #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化目标 #-------------------------------------------------------------------------- def initialize super(0, 0, 480, 480) self.contents = Bitmap.new(width - 32, height - 32) refresh self.active = false self.index = -1 self.z = 201 end end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size x = 80 + (i * 110) y = 420 actor = $game_party.actors[i] bitmap = Bitmap.new("Graphics/Menu/" + actor.id.to_s + "_2D") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect) end for i in 0...$game_party.actors.size x = 80 + (i * 110) y = 420 actor = $game_party.actors[i] bitmap = Bitmap.new("Graphics/Menu/" + actor.id.to_s + "_2D_2") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect) end end #-------------------------------------------------------------------------- # ● 刷新光标矩形 #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty else self.cursor_rect.set(0, @index * 116, self.width - 32, 96) end end
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
# 显示菜单画面和同伴状态的窗口。
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化目标
#--------------------------------------------------------------------------
def initialize
super(0, 0, 480, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
self.z = 201
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 80 + (i * 110)
y = 420
actor = $game_party.actors[i]
bitmap = Bitmap.new("Graphics/Menu/" + actor.id.to_s + "_2D")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
for i in 0...$game_party.actors.size
x = 80 + (i * 110)
y = 420
actor = $game_party.actors[i]
bitmap = Bitmap.new("Graphics/Menu/" + actor.id.to_s + "_2D_2")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
|