赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 3314 |
最后登录 | 2016-8-17 |
在线时间 | 18 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 18 小时
- 注册时间
- 2015-12-25
- 帖子
- 33
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
这是945窗口教程进行修改之后的脚本,增加了按F6打开关闭状态栏的功能。不过我是要请教一下,如何在状态栏开闭渐变过程中,角色依旧可以行走。求高手解答。
#============================================================================== # ■ Class_Actor #============================================================================== class Game_Actor < Game_Battler alias moming_refresh refresh alias moming_tp tp= alias moming_add_state add_state #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh moming_refresh $refresh = true end #---------------------------------------------------------------------------- # ● 更改 TP #---------------------------------------------------------------------------- def tp=(tp) moming_tp(tp) $refresh = true end #---------------------------------------------------------------------------- # ● 附加状态 #---------------------------------------------------------------------------- def add_state(state_id) moming_add_state(state_id) $refresh = true end end #============================================================================== # ■ Game_Party #============================================================================== class Game_Party alias moming_swap_order swap_order #---------------------------------------------------------------------------- # ● 交换顺序 #---------------------------------------------------------------------------- def swap_order(index1, index2) moming_swap_order(index1, index2) $refresh = true end end #============================================================================== # ■ Window_MapStatus #============================================================================== class Window_MapStatus < Window_Base #---------------------------------------------------------------------------- # ● 初始化 #---------------------------------------------------------------------------- def initialize super(0, 0, 273, 144) self.opacity = 0 refresh end #---------------------------------------------------------------------------- # ● 刷新画面 #---------------------------------------------------------------------------- def update super refresh if $refresh $refresh = false if contents_opacity != 0 if $game_player.screen_x >= 0 and $game_player.screen_x <= self.width and $game_player.screen_y >= 0 and $game_player.screen_y <= self.height self.contents_opacity = 75 else self.contents_opacity = 255 end end end #---------------------------------------------------------------------------- # ● 更新内容 #---------------------------------------------------------------------------- def refresh contents.clear draw_actor_face($game_party.members[0], 0, 0) contents.draw_text(0,0,contents.width,24,$game_party.members[0].name,2) draw_actor_level($game_party.members[0], 101, 0) draw_actor_icons($game_party.members[0], 0, 72) draw_actor_hp($game_party.members[0], 101, 24, self.contents.width - 101) draw_actor_mp($game_party.members[0], 101, 48, self.contents.width - 101) draw_actor_tp($game_party.members[0], 101, 72, self.contents.width - 101) draw_actor_exp($game_party.members[0], 0, 96, self.contents.width) end #---------------------------------------------------------------------------- # ● 描绘EXP槽 #---------------------------------------------------------------------------- def draw_actor_exp(actor, x, y, width=124) rate = actor.exp.to_f / actor.next_level_exp.to_f draw_gauge(x, y, width, rate, Color.new(0, 255, 0), Color.new(100, 255, 100)) self.contents.font.color = text_color(16) self.contents.draw_text(x, y, 56, 24, "EXP") self.contents.font.color = Color.new(255, 255, 255) en = "#{actor.exp}/#{actor.next_level_exp}" self.contents.draw_text(x, y, width, 24, en, 2) end #---------------------------------------------------------------------------- # ● 描绘值槽 #---------------------------------------------------------------------------- def draw_gauge(x, y, width, rate, color1, color2) fill_w = (width * rate).to_i self.contents.gradient_fill_rect(x, y+12, fill_w, 6, color1, color2, true) self.contents.gradient_fill_rect(x, y+18, fill_w, 6, color2, color1, true) self.contents.fill_rect(x, y+12, width, 1, Color.new(255, 255, 255)) self.contents.fill_rect(x, y+22, width, 1, Color.new(255, 255, 255)) self.contents.fill_rect(x, y+14, 1, 8, Color.new(255, 255, 255)) self.contents.fill_rect(x+width-2, y+14, 1, 8, Color.new(255, 255, 255)) end end #============================================================================== # ■ Scene_Map #============================================================================== class Scene_Map < Scene_Base #---------------------------------------------------------------------------- # ● 重命名方法 #---------------------------------------------------------------------------- alias moming_sta start alias moming_update update #---------------------------------------------------------------------------- # ● 开始处理 #---------------------------------------------------------------------------- def start moming_sta @mapstatus_window = Window_MapStatus.new end #---------------------------------------------------------------------------- # ● 更新处理 #---------------------------------------------------------------------------- def update moming_update ms_update_input end #---------------------------------------------------------------------------- # ● 按键检测 #---------------------------------------------------------------------------- def ms_update_input if Input.trigger?(:F6) if @mapstatus_window.contents_opacity != 0 gra_close else gra_open end end end #---------------------------------------------------------------------------- # ● 定义窗口淡入、淡出 #---------------------------------------------------------------------------- def gra_close 60.times do |i| @mapstatus_window.contents_opacity -= 4.25 Graphics.update end end def gra_open 60.times do |i| @mapstatus_window.contents_opacity += 4.25 Graphics.update end end end #转自945窗口脚本教程,并稍作修改。
#==============================================================================
# ■ Class_Actor
#==============================================================================
class Game_Actor < Game_Battler
alias moming_refresh refresh
alias moming_tp tp=
alias moming_add_state add_state
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
moming_refresh
$refresh = true
end
#----------------------------------------------------------------------------
# ● 更改 TP
#----------------------------------------------------------------------------
def tp=(tp)
moming_tp(tp)
$refresh = true
end
#----------------------------------------------------------------------------
# ● 附加状态
#----------------------------------------------------------------------------
def add_state(state_id)
moming_add_state(state_id)
$refresh = true
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party
alias moming_swap_order swap_order
#----------------------------------------------------------------------------
# ● 交换顺序
#----------------------------------------------------------------------------
def swap_order(index1, index2)
moming_swap_order(index1, index2)
$refresh = true
end
end
#==============================================================================
# ■ Window_MapStatus
#==============================================================================
class Window_MapStatus < Window_Base
#----------------------------------------------------------------------------
# ● 初始化
#----------------------------------------------------------------------------
def initialize
super(0, 0, 273, 144)
self.opacity = 0
refresh
end
#----------------------------------------------------------------------------
# ● 刷新画面
#----------------------------------------------------------------------------
def update
super
refresh if $refresh
$refresh = false
if contents_opacity != 0
if $game_player.screen_x >= 0 and $game_player.screen_x <= self.width and
$game_player.screen_y >= 0 and $game_player.screen_y <= self.height
self.contents_opacity = 75
else self.contents_opacity = 255
end
end
end
#----------------------------------------------------------------------------
# ● 更新内容
#----------------------------------------------------------------------------
def refresh
contents.clear
draw_actor_face($game_party.members[0], 0, 0)
contents.draw_text(0,0,contents.width,24,$game_party.members[0].name,2)
draw_actor_level($game_party.members[0], 101, 0)
draw_actor_icons($game_party.members[0], 0, 72)
draw_actor_hp($game_party.members[0], 101, 24, self.contents.width - 101)
draw_actor_mp($game_party.members[0], 101, 48, self.contents.width - 101)
draw_actor_tp($game_party.members[0], 101, 72, self.contents.width - 101)
draw_actor_exp($game_party.members[0], 0, 96, self.contents.width)
end
#----------------------------------------------------------------------------
# ● 描绘EXP槽
#----------------------------------------------------------------------------
def draw_actor_exp(actor, x, y, width=124)
rate = actor.exp.to_f / actor.next_level_exp.to_f
draw_gauge(x, y, width, rate, Color.new(0, 255, 0), Color.new(100, 255, 100))
self.contents.font.color = text_color(16)
self.contents.draw_text(x, y, 56, 24, "EXP")
self.contents.font.color = Color.new(255, 255, 255)
en = "#{actor.exp}/#{actor.next_level_exp}"
self.contents.draw_text(x, y, width, 24, en, 2)
end
#----------------------------------------------------------------------------
# ● 描绘值槽
#----------------------------------------------------------------------------
def draw_gauge(x, y, width, rate, color1, color2)
fill_w = (width * rate).to_i
self.contents.gradient_fill_rect(x, y+12, fill_w, 6, color1, color2, true)
self.contents.gradient_fill_rect(x, y+18, fill_w, 6, color2, color1, true)
self.contents.fill_rect(x, y+12, width, 1, Color.new(255, 255, 255))
self.contents.fill_rect(x, y+22, width, 1, Color.new(255, 255, 255))
self.contents.fill_rect(x, y+14, 1, 8, Color.new(255, 255, 255))
self.contents.fill_rect(x+width-2, y+14, 1, 8, Color.new(255, 255, 255))
end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#----------------------------------------------------------------------------
# ● 重命名方法
#----------------------------------------------------------------------------
alias moming_sta start
alias moming_update update
#----------------------------------------------------------------------------
# ● 开始处理
#----------------------------------------------------------------------------
def start
moming_sta
@mapstatus_window = Window_MapStatus.new
end
#----------------------------------------------------------------------------
# ● 更新处理
#----------------------------------------------------------------------------
def update
moming_update
ms_update_input
end
#----------------------------------------------------------------------------
# ● 按键检测
#----------------------------------------------------------------------------
def ms_update_input
if Input.trigger?(:F6)
if @mapstatus_window.contents_opacity != 0
gra_close
else
gra_open
end
end
end
#----------------------------------------------------------------------------
# ● 定义窗口淡入、淡出
#----------------------------------------------------------------------------
def gra_close
60.times do |i|
@mapstatus_window.contents_opacity -= 4.25
Graphics.update
end
end
def gra_open
60.times do |i|
@mapstatus_window.contents_opacity += 4.25
Graphics.update
end
end
end
#转自945窗口脚本教程,并稍作修改。
|
|