一个实用的提示脚本
做游戏衍生出的东西,现在献丑拿出来发布一下功能:显示提示框(与得失物品提示脚本不同的是,该对话框可以随着地图刷新,不影响游戏流畅)
使用方法:在事件中输入脚本 tip("提示内容") 即可$提示框弹出时间 = 20class Window_Tip < Window_Basedef 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 = 0enddef 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 += 1endendclass Game_Tempattr_accessor :tippingendclass Interpreterdef tip(text) $game_temp.tipping = textendendclass Scene_Mapalias b_m maindef main @tip = Window_Tip.new b_m @tip.disposeendalias u updatedef update @tip.refresh if $game_temp.tipping uendend复制代码
本帖来自P1论坛作者heiwang1997,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=249642若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]