12-25-2013, 04:31 PM
Hi people! I have a script that allows short messages to appear in the lower-right corner without pausing the game action, making the gameplay smoother. I decided to add an Icon to make it nicer, however, due to my lack of expertise in RGSS, the icon always appears and I want it to appear AND disappear along with the text, I think it's a very easy scripting but I do not know how to do it :v
The code:
and an image:
The code:
Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#|Autor: RD12| Mensagens na Tela v1.5
#-------------------------------------------------------------------
#Chame o script: Msg_txt("Texto", cor) onde cor = red, blue..
#É opcional por a cor, se você não por, ficará branca.
#--------------------------------------------------------------------
module WIN_MSG
X = 373
Y = 0
L = 300#largura
Windowskin = "windowskin" #"001-blue01"
#Tempo em segundos para ir deletando as mensagens
Clear_Time = 7
end
#::Cores::
def red; return Color.new(255, 0, 0); end
def green; return Color.new(0, 255, 0); end
def blue; return Color.new(0, 0, 255); end
def black; return Color.new(0, 0, 0); end
def white; return Color.new(255, 255, 255); end
class Window_Msg < Window_Base
def initialize
super(WIN_MSG::X,WIN_MSG::Y,WIN_MSG::L,30*2)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 126
self.windowskin = RPG::Cache.windowskin(WIN_MSG::Windowskin)
color = Color.new(255, 255, 255)
$Msg_log = [["", color], ["", color], ["", color], ["", color]]
self.y = 420
Msg_txt("")
refresh
end
def refresh
self.contents.clear
self.contents.font.name = "Corbel"
self.contents.font.size = 15
#::Escrever as Mensagens::
bitmap = RPG::Cache.icon("info.png")
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.font.color = $Msg_log[$Msg_log.size-1][1]
self.contents.draw_text(40, 0, 310, 32, "#{$Msg_log[$Msg_log.size-1][0]}")
end
end
def Msg_txt(text, color=Color.new(255, 255, 255))
$Msg_log << [text, color]
end
class Scene_Map
alias me_main main
def main
@win_msg = Window_Msg.new
me_main
@win_msg.dispose
end
alias msg_update update
def update
msg_update
@win_msg.refresh
if Graphics.frame_count % (40*WIN_MSG::Clear_Time) == 0
Msg_txt("")
end
end
end
and an image:
I'm looking for a scripter to help me with my proyect. Need some minor adjustments-modifications and some larger codes. The larger ones will be remunerated :) Thanks beforehand.