做游戏衍生出的东西,现在献丑拿出来发布一下
功能:显示提示框(与得失物品提示脚本不同的是,该对话框可以随着地图刷新,不影响游戏流畅)
使用方法:在事件中输入脚本 tip("提示内容") 即可 - $提示框弹出时间 = 20class Window_Tip < Window_Base def initialize super(0,300,128,64) self.contents_opacity = 0 self.opacity = 0 self.contents = Bitmap.new(width - 32, height - 32) self.z = 9999 @p = 0 end def refresh text = $game_temp.tipping self.x = (580-(text.to_s.size / 3 * 32))/2 self.width = (text.to_s.size / 3 * 32)+32 self.contents = Bitmap.new(width - 32, height - 32) self.contents.draw_text(0, -2, (text.to_s.size / 3 * 32), 32, text,1) case @p when 0..40 self.opacity += 30 self.contents_opacity += 30 when (40 + $提示框弹出时间)..(80 + $提示框弹出时间) self.opacity -= 30 self.contents_opacity -= 30 when (81 + $提示框弹出时间) $game_temp.tipping = nil self.opacity = 0 self.contents_opacity = 0 @p = -1 end @p += 1 endendclass Game_Temp attr_accessor :tippingendclass Interpreter def tip(text) $game_temp.tipping = text endendclass Scene_Map alias b_m main def main @tip = Window_Tip.new b_m @tip.dispose end alias u update def update @tip.refresh if $game_temp.tipping u endend复制代码
复制代码 本帖来自P1论坛作者heiwang1997,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=249642 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。 |