Feedback on new rain script
#1
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
Reply }
#2
That's a lot better than the basic rain effect.
I noticed two things however :
1. there's an area on the top of the screen where splashes don't appear (their y coordinates are rand(480) + rand(75) + 10 + rand(25) - rand(5) : to have a small value all the three first random numbers must be small).
2. splashes appear on "vertical" elements, such as tree trunks or fronts of houses, though it seems that it's raining vertically. Perhaps you could use terrain tags to filter tiles where splashes can be displayed.

Oh, and for the coding part, I hope you'll use a picture for splashes, because using set_pixel to draw always the same thing is rather low.
Some scripts :
Working on :
Reply }
#3
I am using a picture, I transcribed it into pixels for easy set up on here :)

Thanks a lot for helpful feedback. I don't remember why I did that with the splashes. I will definitively do what you said about the terrain tags.
Valdred
Tech Administrator of Save-Point
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Plugin or Script help with Item menu, SKill menu, and Equip menu JayRay 2 62 Yesterday, 03:09 AM
Last Post: JayRay
   Script compatibility help Lord Vectra 3 4,602 07-25-2021, 11:42 PM
Last Post: DerVVulfman
   Adding face script on Cogwheel's RTAB Battle Status rekkatsu 15 15,839 08-25-2020, 03:09 AM
Last Post: DerVVulfman
   "Wait" in the script Whisper 13 16,159 04-28-2020, 04:06 PM
Last Post: Whisper
   Skill Cooldown script Fenriswolf 11 16,438 12-10-2019, 11:10 AM
Last Post: Fenriswolf
   Help iwth script (RGSS Player crash) Whisper 3 8,530 06-17-2017, 05:03 PM
Last Post: Whisper
   Help modifying a script Keeroh 7 10,209 06-11-2017, 04:43 PM
Last Post: DerVVulfman
Question  Mog Menu script: help me stop the crazy picture movement during transitions Zachariad 4 9,852 05-31-2017, 05:10 AM
Last Post: Zachariad
   Actor names in Quest Script jreagan406 5 8,636 03-07-2017, 08:06 AM
Last Post: JayRay
   Bizarre issue with Lanzer counter script. Steel Beast 6Beets 2 7,245 10-04-2016, 11:46 AM
Last Post: Steel Beast 6Beets



Users browsing this thread: 1 Guest(s)