Project1

标题: 如何做游戏提示语 [打印本页]

作者: 110007    时间: 2013-12-7 22:57
标题: 如何做游戏提示语
如何做游戏里面面的提示语,如右图[attachimg]206601

QQ图片20131207225412.jpg (27.29 KB, 下载次数: 15)

QQ图片20131207225412.jpg

作者: 110007    时间: 2013-12-7 23:04
是RMXP游戏
作者: dmengyu    时间: 2013-12-8 13:47
显示提示框
RUBY 代码复制
  1. #   使用方法:在事件中输入脚本    tip("提示内容") 即可
  2. $提示框弹出时间 = 20
  3. class Window_Tip < Window_Base
  4.   def initialize
  5.     super(0,300,128,64)
  6.     self.contents_opacity = 0
  7.     self.opacity = 0
  8.     self.contents = Bitmap.new(width - 32, height - 32)
  9.     self.z = 9999
  10.  
  11.     @p = 0
  12.   end
  13.   def refresh
  14.     text = $game_temp.tipping
  15.     self.x = (580-(text.to_s.size / 3 * 32))/2
  16.     self.width = (text.to_s.size / 3 * 32)+32
  17.     self.contents = Bitmap.new(width - 32, height - 32)
  18.     self.contents.draw_text(0, -2, (text.to_s.size / 3 * 32), 32, text,1)
  19.     self.opacity=160
  20.     case @p
  21.     when 0..40
  22.       self.opacity += 10
  23.       self.contents_opacity += 10
  24.     when (40 + $提示框弹出时间)..(70 + $提示框弹出时间)
  25.       self.opacity -= 10
  26.       self.contents_opacity -= 10
  27.     when (71 + $提示框弹出时间)
  28.       $game_temp.tipping = nil
  29.       self.opacity = 0
  30.       self.contents_opacity = 0
  31.       @p = -1
  32.     end
  33.     @p += 1
  34.   end
  35. end
  36. class Game_Temp
  37.   attr_accessor :tipping
  38. end
  39. class Interpreter
  40.   def tip(text)
  41.     $game_temp.tipping = text
  42.   end
  43. end
  44. class Scene_Map
  45.   alias b_m main
  46.   def main
  47.     @tip = Window_Tip.new
  48.     b_m
  49.     @tip.dispose
  50.   end
  51.   alias u update
  52.   def update
  53.     @tip.refresh if $game_temp.tipping
  54.     u
  55.   end
  56. end

作者: dmengyu    时间: 2013-12-8 13:49
你要发到RMXP提问区
作者: 110007    时间: 2013-12-8 17:25
不行啊啊,你看下
作者: 110007    时间: 2013-12-8 17:27





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