Project1

标题: 怎么修改这个脚本达到显示这张图片? [打印本页]

作者: .さっとりーん    时间: 2012-8-5 07:43
标题: 怎么修改这个脚本达到显示这张图片?
求教下
脚本盲求救
  1. #==============================================================================
  2. # ★RGSS2
  3. # *STR11b_XP Battle Style #Battle Message v1.2 08/01/26
  4. # Created by star: http://otsu.cool.ne.jp/strcatyou/
  5. # Translated by Mr. Bubble
  6. #
  7. # ・Battle message appears with transparent background at
  8. #  the upper left of the screen.
  9. #
  10. #------------------------------------------------------------------------------

  11. #==============================================================================
  12. # ■ Window_BattleMessage
  13. #==============================================================================
  14. class Window_BattleMessage < Window_Message
  15.   # Gradient Background [Left, Right]
  16.   TEXT_B_COLOR = [Color.new(0,0,0,160), Color.new(0,0,0,0)]
  17.   INFO      = "信息" # String that shows at the upper left of message window
  18.   BTWIDTH   = 360       # Message Width
  19.   MOVE      = true      # Smooth resize of lines
  20.   SPEED     = 1         # Resize Speed
  21.   W_OPACITY = 96        # Transparency 1~255
  22.   #
  23.   N_WINDOW  = false     # Window is not converted transparent
  24.   #--------------------------------------------------------------------------
  25.   # ★ エイリアス
  26.   #--------------------------------------------------------------------------
  27.   alias initialize_str11b initialize
  28.   def initialize
  29.     initialize_str11b
  30.     self.x = 0
  31.     self.y = 0
  32.     self.back_opacity = 0
  33.     self.opacity = 0
  34.     unless N_WINDOW
  35.       @b_sprite = Sprite.new(self.viewport)
  36.       bitmap = Bitmap.new(BTWIDTH, 96 + 16)
  37.       bitmap.gradient_fill_rect(0, 16, BTWIDTH, 96, TEXT_B_COLOR[0], TEXT_B_COLOR[1])
  38.       bitmap.font.shadow = false
  39.       bitmap.font.size = 16
  40.       bitmap.draw_text(2, 2, BTWIDTH, 16, INFO)
  41.       @b_sprite.bitmap = bitmap
  42.       @b_sprite.x = self.x
  43.       @b_sprite.y = self.y
  44.       @b_sprite.src_rect.height = 16
  45.       @b_sprite.opacity = 0
  46.       @str11f = false
  47.     end
  48.   end
  49.   alias dispose_str11b dispose
  50.   def dispose
  51.     dispose_str11b
  52.     unless N_WINDOW
  53.       @b_sprite.bitmap.dispose
  54.       @b_sprite.dispose
  55.     end
  56.   end
  57.   alias update_str11b update
  58.   def update
  59.     update_str11b
  60.    
  61.     unless N_WINDOW
  62.       if self.visible and (@lines.size > 0 and not @str11f) or
  63.          (@text != nil or self.pause or @index > -1)
  64.         @b_sprite.opacity += W_OPACITY
  65.         h = @b_sprite.src_rect.height
  66.         if @text != nil
  67.           @l = 4
  68.         else
  69.           unless self.pause or @index > -1
  70.             @l = @lines.size
  71.           else
  72.             @l = 4
  73.           end
  74.         end
  75.         if MOVE
  76.           if SPEED == 1
  77.             @b_sprite.src_rect.height = 16 + (@l * 24)
  78.           else
  79.             s = (SPEED - 1)
  80.             @b_sprite.src_rect.height = (h + ((16 + (@l * 24)) * s)) / SPEED
  81.           end
  82.         else
  83.           @b_sprite.src_rect.height = 96 + 16
  84.         end
  85.       else
  86.         @b_sprite.opacity -= W_OPACITY
  87.       end
  88.     else
  89.       if self.visible
  90.         self.back_opacity += W_OPACITY
  91.         self.opacity += W_OPACITY
  92.         self.back_opacity = 200 if self.back_opacity > 200
  93.       else
  94.         self.back_opacity -= W_OPACITY
  95.         self.opacity -= W_OPACITY
  96.       end
  97.     end
  98.   end
  99. end
复制代码

显示这张图片,该出现时就出现,消失时就消失。
dsu_plus_rewardpost_czw
作者: yychchhh    时间: 2012-8-5 08:53
不需要脚本,事件显示图片就好了
作者: 忧雪の伤    时间: 2012-8-7 20:53
UI> 楼主想问的是啥我没听懂。
作者: devilg    时间: 2012-8-8 11:08
不明白是在哪里显示那张背景图片,是要让那张背景图变成战斗消息窗口的窗口设定么?
如果是这样,在scene内创建开始窗口之前放一个@sprite1= Sprite.new和 @sprite.bitmap=cache.????就可以达到成为背景图片的目的。消失是@sprite1.visible=false.我不知道在super之前做sprite是不是也能实现相同的效果
作者: .さっとりーん    时间: 2012-8-9 19:34
devilg 发表于 2012-8-8 11:08
不明白是在哪里显示那张背景图片,是要让那张背景图变成战斗消息窗口的窗口设定么?
如果是这样,在scene内 ...

对啊
不过修改后无法消失
清帮忙修改一下




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1