04-17-2011, 08:36 PM
Basically, I wrote a script for new rain visuals. I am going to use it in my game so it is not for reuse at this point. Feedback?
Code:
class Scene_Map
alias old_init_valdred initialize
def initialize
old_init_valdred
@weather = Sprite.new
@weather.bitmap = Bitmap.new(640,480)
@weather.z = 99998
@t = Sprite.new
@t.bitmap = Bitmap.new(640, 480)
@t.bitmap.font.color = Color.new(0,0,0)
@t.bitmap.draw_text(0,0,640,20,"Not for use. Not for redistribution", 1)
@t.bitmap.draw_text(0,460,640,20,"Save-Point.org - Valdred", 1)
@t.z = 99999
end
def draw_rain
# Reset bitmap
@weather.bitmap.clear
# Draw rain
for i in 1..60
c = Color.new(225,225,225,100)
x = rand(640)
y = rand(480)
w = 1
h = rand(75) + 10
@weather.bitmap.fill_rect(x, y, w, h, c)
# Extend weather
y += rand(25)
h -= rand(5)
c.alpha -= rand(80)
@weather.bitmap.fill_rect(x, y, w, h, c)
# Add splash
bitmap = Bitmap.new(32,32)
bitmap.set_pixel(12,14,Color.new(225,225,225))
bitmap.set_pixel(13,16,Color.new(225,225,225))
bitmap.set_pixel(14,15,Color.new(225,225,225))
bitmap.set_pixel(14,18,Color.new(225,225,225))
bitmap.set_pixel(15,18,Color.new(225,225,225))
bitmap.set_pixel(16,18,Color.new(225,225,225))
bitmap.set_pixel(17,18,Color.new(225,225,225))
bitmap.set_pixel(15,17,Color.new(225,225,225))
bitmap.set_pixel(17,17,Color.new(225,225,225))
rect = bitmap.rect
@weather.bitmap.blt(x, y + h, bitmap, rect, 150)
end
end
alias update_old_valdred update
def update
update_old_valdred
draw_rain
end
end
Valdred
Tech Administrator of Save-Point
Tech Administrator of Save-Point