| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 1 |  
| 经验 | 1940 |  
| 最后登录 | 2020-5-5 |  
| 在线时间 | 6 小时 |  
 Lv1.梦旅人 
	梦石0 星屑60 在线时间6 小时注册时间2008-1-9帖子109 | 
| 
下面这个脚本,我想让自定义X,Y只是角色所在的脚下,但我把$x=0     #自定义窗口X
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  $y=0     #自定义窗口Y这两个的0值改为$game_player.x,$game_player.y后,却报告没有X和Y的值,我要如何才能声明这两个变量运用到这个脚本中去??
 
 
 
 复制代码
#-------------------------------------------------------------------------
# ● 时间条参数设定
#    设定技巧:可以根据"设定移动速度"来放慢或加快移动
#             如果设置"移动速度"为负数,就会倒退走(必须$minbar<=$maxbar)
#             如果时间条的宽度小,可以把$nextbar设置为小数来放慢速度
#-------------------------------------------------------------------------
#设置时间条初始值
$minbar=0
#设置时间条的最大值,宽度
$maxbar=200
#设置时间条的移动速度可以是"小数"或"整数(负数)"
$nextbar=1
#设置时间条运行和显示的开关,和初始化开关
$show=1 #显示/隐藏时间条 
$stop=2 #启动/停止时间条
$init=3 #初始化时间条
$done=4 #到时间之后打开的开关,可以用个自动执行的公共时间调此开关
#设置窗口宽高
$width=$maxbar+114
$height=64
#设置窗口位置
$o=2 
#设置参考
#        0-采用$x,$y的自定义设置
#        1-左上角
#        2-正上
#        3-右上角
#        4-正中
#        5-左下角
#        6-正下
#        7-右下角
$x=0     #自定义窗口X
$y=0     #自定义窗口Y
#定义窗口透明程度,0透明,255不透明数值范围0~255
$opacity=0         #设置窗口边框透明度
$back_opacity=0    #设置窗口背景透明度
#------------------------------------------------------------------------
# ● 时间条描绘
#------------------------------------------------------------------------
def draw_time_bar(x, y, width)
  # 边框设定
  self.contents.font.color = system_color
  self.contents.draw_text(x,y,60,32,"时间:")
  self.contents.fill_rect(x-2+60, y+16, width+4,8, Color.new(255, 255, 255, 255))
  self.contents.fill_rect(x-1+60, y+17, width+2,6, Color.new(0, 0, 0, 255))
  # 时间条长度设定
  w = $minbar
  # 时间条颜色设定
  self.contents.fill_rect(x+60, y+18, w,1, Color.new(96,255, 96, 255))
  self.contents.fill_rect(x+60, y+19, w,1, Color.new(0, 255, 0, 255))
  self.contents.fill_rect(x+60, y+20, w,1, Color.new(0, 128, 0, 255))
  self.contents.fill_rect(x+60, y+21, w,1, Color.new(0, 0, 0, 255))
end 
#----------------------------------------------------------------------------
# ● 时间窗口描绘
#----------------------------------------------------------------------------
class Window_Timebar < Window_Base
 #--------------------------------------------------------------------------
 # ● 初始化窗口
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, $width, $height)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 #--------------------------------------------------------------------------
 # ● 窗口内容
 #--------------------------------------------------------------------------
 def refresh
   #判断时间窗口是否可见
   if $game_switches[$show]
     self.visible=true
   else
     self.visible=false
   end
   
   #设置时间窗口透明度
   self.back_opacity=$back_opacity
   self.opacity=$opacity
   
   #设置窗口位置
   case $o
   when 0
     self.x=$x
     self.y=$y
   when 1
     self.x=0
     self.y=0
   when 2
     self.x=320-$width/2
     self.y=0
   when 3
     self.x=640-$width
     self.y=0
   when 4
     self.x=320-$width/2
     self.y=240-$height/2
   when 5
     self.x=0
     self.y=480-$height
   when 6
     self.x=320-$width/2
     self.y=480-$height
   when 7
     self.x=640-$width
     self.y=480-$height
   else
     #防止错误发生
     self.x=0
     self.y=0
   end
   
   #窗口内容
   self.contents.clear
   draw_time_bar(4,0,$maxbar)
 end
end
#-----------------------------------------------------------------------------
# ● 地图上显示时间描绘
#-----------------------------------------------------------------------------
class Scene_Map
 # 声明别名,以免冲突,主要用于功能追加
 alias mohock_main main
 def main
  # 生成倒计时窗口
  @time_bar=Window_Timebar.new
  # 调用别名 (具体功能不清楚,但是不调用必定有错误)
  mohock_main
  # 释放倒计时窗口
  @time_bar.dispose
 end
 # 声明别名,以免冲突,主要用于功能追加
 alias mohock_update update
 def update
  # 如果初始化开关打开
  if $game_switches[$init]
    # 初始化数值
    $minbar=0
    $game_switches[$init]=false
  end
  # 刷新时间条,增加数值自己改动
  if $game_switches[$stop]
    #判断是否超过最大数值,是则执行任务,不是继续增加
    if $minbar >= $maxbar
     #执行开关设置为真 
     $game_variables[$done] = true
    else
     $minbar += $nextbar
    end
  end
   @time_bar.refresh
   # 调用别名 (具体功能不清楚,但是不调用必定有错误)
   mohock_update
 end
end
 
 
 ----------------版务----------------
 如果问题未解决,请继续提问
 如果问题已解决,请结贴
 若到末贴发贴时间后一周仍未结贴
 管理员会自动为你过期帖子、结贴或强行认可答案(好人卡-1)
 此贴于 2008-3-26 0:14:53 被版主水迭澜提醒,请楼主看到后对本贴做出回应。
 | 
 |