Project1

标题: 寻找脚本 [打印本页]

作者: daxuexinsheng    时间: 2012-6-17 09:53
标题: 寻找脚本
本帖最后由 daxuexinsheng 于 2012-6-17 11:03 编辑

请问谁有夏娜的“昼夜、日期、天气系统”的脚本啊?dsu_plus_rewardpost_czw
作者: hys111111    时间: 2012-6-17 10:03
本帖最后由 hys111111 于 2012-6-17 10:31 编辑

飘树叶:
  1. #===========================
  2. #  ccoa's weather script
  3. #   with ideas by ScriptKitty and Mr.DJ
  4. #===========================
  5. #  Weather Types:
  6. #    1 - rain
  7. #    2 - storm
  8. #    3 - snow
  9. #    4 - hail
  10. #    5 - rain with thunder and lightning
  11. #    6 - falling leaves (autumn)
  12. #    7 - blowing leaves (autumn)
  13. #    8 - swirling leaves (autumn)
  14. #    9 - falling leaves (green)
  15. #   10 - cherry blossom (sakura) petals
  16. #   11 - rose petals
  17. #   12 - feathers
  18. #   13 - blood rain
  19. #   14 - sparkles
  20. #   15 - user defined
  21. #
  22. #  Weather Power:
  23. #    An integer from 0-40.  0 = no weather, 40 = 400 sprites
  24. #
  25. #  Usage:
  26. #    Create a call script with the following:
  27. #       $game_screen.weather(type, power, hue)
  28. #
  29. #  Usage of user-defined weather:
  30. #    Look at the following globals:

  31. $WEATHER_UPDATE = false   # the $WEATHER_IMAGES array has changed, please update
  32. $WEATHER_IMAGES = []      # the array of picture names to use
  33. $WEATHER_X = 0            # the number of pixels the image should move horizontally (positive = right, negative = left)
  34. $WEATHER_Y = 0            # the number of pizels the image should move vertically (positive = down, negative = up)
  35. $WEATHER_FADE = 0         # how much the image should fade each update (0 = no fade, 255 = fade instantly)
  36. $WEATHER_ANIMATED = false # whether or not the image should cycle through all the images

  37. module RPG
  38. class Weather
  39. def initialize(viewport = nil)
  40.   @type = 0
  41.   @max = 0
  42.   @ox = 0
  43.   @oy = 0
  44.   @count = 0
  45.   @current_pose = []
  46.   @info = []
  47.   @countarray = []

  48.   make_bitmaps

  49.   # **** ccoa ****
  50.   for i in 1..500
  51.     sprite = Sprite.new(viewport)
  52.     sprite.z = 1000
  53.     sprite.visible = false
  54.     sprite.opacity = 0
  55.     @sprites.push(sprite)
  56.     @current_pose.push(0)
  57.     @info.push(rand(50))
  58.     @countarray.push(rand(15))
  59.   end
  60. end

  61. def dispose
  62.   for sprite in @sprites
  63.     sprite.dispose
  64.   end
  65.   @rain_bitmap.dispose
  66.   @storm_bitmap.dispose
  67.   @snow_bitmap.dispose
  68.   @hail_bitmap.dispose
  69.   @petal_bitmap.dispose
  70.   @blood_rain_bitmap.dispose
  71.   for image in @autumn_leaf_bitmaps
  72.     image.dispose
  73.   end
  74.   for image in @green_leaf_bitmaps
  75.     image.dispose
  76.   end
  77.   for image in @rose_bitmaps
  78.     image.dispose
  79.   end
  80.   for image in @feather_bitmaps
  81.     image.dispose
  82.   end
  83.   for image in @sparkle_bitmaps
  84.     image.dispose
  85.   end
  86.   for image in @user_bitmaps
  87.     image.dispose
  88.   end
  89.   $WEATHER_UPDATE = true
  90. end

  91. def type=(type)
  92.   return if @type == type
  93.   @type = type
  94.   case @type
  95.   when 1 # rain
  96.     bitmap = @rain_bitmap
  97.   when 2 # storm
  98.     bitmap = @storm_bitmap
  99.   when 3 # snow
  100.     bitmap = @snow_bitmap
  101.   when 4 # hail
  102.     bitmap = @hail_bitmap
  103.   when 5 # rain w/ thunder and lightning
  104.     bitmap = @rain_bitmap
  105.     @thunder = true
  106.   when 6 # falling autumn leaves
  107.     bitmap = @autumn_leaf_bitmaps[0]
  108.   when 7 # blowing autumn leaves
  109.     bitmap = @autumn_leaf_bitmaps[0]
  110.   when 8 # swirling autumn leaves
  111.     bitmap = @autumn_leaf_bitmaps[0]
  112.   when 9 # falling green leaves
  113.     bitmap = @green_leaf_bitmaps[0]
  114.   when 10 # sakura petals
  115.     bitmap = @petal_bitmap
  116.   when 11 # rose petals
  117.     bitmap = @rose_bitmaps[0]
  118.   when 12 # feathers
  119.     bitmap = @feather_bitmaps[0]
  120.   when 13 # blood rain
  121.     bitmap = @blood_rain_bitmap
  122.   when 14 # sparkles
  123.     bitmap = @sparkle_bitmaps[0]
  124.   when 15 # user-defined
  125.       bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
  126.   else
  127.     bitmap = nil
  128.   end
  129.   if @type != 5
  130.     @thunder = false
  131.   end
  132.   # **** ccoa ****
  133.   for i in 1..500
  134.     sprite = @sprites[i]
  135.     if sprite != nil
  136.       sprite.visible = (i <= @max)
  137.       sprite.bitmap = bitmap
  138.     end
  139.   end
  140. end

  141. def ox=(ox)
  142.   return if @ox == ox;
  143.   @ox = ox
  144.   for sprite in @sprites
  145.     sprite.ox = @ox
  146.   end
  147. end

  148. def oy=(oy)
  149.   return if @oy == oy;
  150.   @oy = oy
  151.   for sprite in @sprites
  152.     sprite.oy = @oy
  153.   end
  154. end

  155. def max=(max)
  156.   return if @max == max;
  157.   # **** ccoa ****
  158.   @max = [[max, 0].max, 500].min
  159.   for i in 1..500
  160.     sprite = @sprites[i]
  161.     if sprite != nil
  162.       sprite.visible = (i <= @max)
  163.     end
  164.   end
  165. end

  166. def update
  167.   return if @type == 0
  168.   for i in 1..@max
  169.     sprite = @sprites[i]
  170.     if sprite == nil
  171.       break
  172.     end
  173.     if @type == 1 or @type == 5 or @type == 13 # rain
  174.       sprite.x -= 2
  175.       sprite.y += 16
  176.       sprite.opacity -= 8
  177.       if @thunder and (rand(8000 - @max) == 0)
  178.         $game_screen.start_flash(Color.new(255, 255, 255, 255), 5)
  179.         Audio.se_play("Audio/SE/061-Thunderclap01")
  180.       end
  181.     end
  182.     if @type == 2 # storm
  183.       sprite.x -= 8
  184.       sprite.y += 16
  185.       sprite.opacity -= 12
  186.     end
  187.     if @type == 3 # snow
  188.       sprite.x -= 2
  189.       sprite.y += 8
  190.       sprite.opacity -= 8
  191.     end
  192.     if @type == 4 # hail
  193.       sprite.x -= 1
  194.       sprite.y += 18
  195.       sprite.opacity -= 15
  196.     end
  197.     if @type == 6 # falling autumn leaves
  198.       @count = rand(20)
  199.       if @count == 0
  200.         sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
  201.         @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
  202.       end
  203.       sprite.x -= 1
  204.       sprite.y += 1
  205.     end
  206.     if @type == 7 # blowing autumn leaves
  207.       @count = rand(20)
  208.       if @count == 0
  209.         sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
  210.         @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
  211.       end
  212.       sprite.x -= 10
  213.       sprite.y += (rand(4) - 2)
  214.     end
  215.     if @type == 8 # swirling autumn leaves
  216.       @count = rand(20)
  217.       if @count == 0
  218.         sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
  219.         @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
  220.       end
  221.       if @info[i] != 0
  222.         if @info[i] >= 1 and @info[i] <= 10
  223.           sprite.x -= 3
  224.           sprite.y -= 1
  225.         elsif @info[i] >= 11 and @info[i] <= 16
  226.           sprite.x -= 1
  227.           sprite.y -= 2
  228.         elsif @info[i] >= 17 and @info[i] <= 20
  229.           sprite.y -= 3
  230.         elsif @info[i] >= 21 and @info[i] <= 30
  231.           sprite.y -= 2
  232.           sprite.x += 1
  233.         elsif @info[i] >= 31 and @info[i] <= 36
  234.           sprite.y -= 1
  235.           sprite.x += 3
  236.         elsif @info[i] >= 37 and @info[i] <= 40
  237.           sprite.x += 5
  238.         elsif @info[i] >= 41 and @info[i] <= 46
  239.           sprite.y += 1
  240.           sprite.x += 3
  241.         elsif @info[i] >= 47 and @info[i] <= 58
  242.           sprite.y += 2
  243.           sprite.x += 1
  244.         elsif @info[i] >= 59 and @info[i] <= 64
  245.           sprite.y += 3
  246.         elsif @info[i] >= 65 and @info[i] <= 70
  247.           sprite.x -= 1
  248.           sprite.y += 2
  249.         elsif @info[i] >= 71 and @info[i] <= 81
  250.           sprite.x -= 3
  251.           sprite.y += 1
  252.         elsif @info[i] >= 82 and @info[i] <= 87
  253.           sprite.x -= 5
  254.         end
  255.         @info[i] = (@info[i] + 1) % 88
  256.       else
  257.         if rand(200) == 0
  258.           @info[i] = 1
  259.         end
  260.         sprite.x -= 5
  261.         sprite.y += 1
  262.       end
  263.     end
  264.     if @type == 9 # falling green leaves
  265.       if @countarray[i] == 0
  266.         @current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
  267.         sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
  268.         @countarray[i] = rand(15)
  269.       end
  270.       @countarray[i] = (@countarray[i] + 1) % 15
  271.       sprite.y += 1
  272.     end
  273.     if @type == 10 # sakura petals
  274.       if @info[i] < 25
  275.         sprite.x -= 1
  276.       else
  277.         sprite.x += 1
  278.       end
  279.       @info[i] = (@info[i] + 1) % 50
  280.       sprite.y += 1
  281.     end
  282.     if @type == 11 # rose petals
  283.       @count = rand(20)
  284.       if @count == 0
  285.         sprite.bitmap = @rose_bitmaps[@current_pose[i]]
  286.         @current_pose[i] = (@current_pose[i] + 1) % @rose_bitmaps.size
  287.       end
  288.       if @info[i] % 2 == 0
  289.         if @info[i] < 10
  290.           sprite.x -= 1
  291.         else
  292.           sprite.x += 1
  293.         end
  294.       end
  295.       sprite.y += 1
  296.     end
  297.     if @type == 12 # feathers
  298.       if @countarray[i] == 0
  299.         @current_pose[i] = (@current_pose[i] + 1) % @feather_bitmaps.size
  300.         sprite.bitmap = @feather_bitmaps[@current_pose[i]]
  301.       end
  302.       @countarray[i] = (@countarray[i] + 1) % 15
  303.       if rand(100) == 0
  304.         sprite.x -= 1
  305.       end
  306.       if rand(100) == 0
  307.         sprite.y -= 1
  308.       end
  309.       if @info[i] < 50
  310.         if rand(2) == 0
  311.           sprite.x -= 1
  312.         else
  313.           sprite.y -= 1
  314.         end
  315.       else
  316.         if rand(2) == 0
  317.           sprite.x += 1
  318.         else
  319.           sprite.y += 1
  320.         end
  321.       end
  322.       @info[i] = (@info[i] + 1) % 100
  323.     end
  324.     if @type == 14 # sparkles
  325.       if @countarray[i] == 0
  326.         @current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size
  327.         sprite.bitmap = @sparkle_bitmaps[@current_pose[i]]
  328.       end
  329.       @countarray[i] = (@countarray[i] + 1) % 15
  330.       sprite.y += 1
  331.       sprite.opacity -= 1
  332.     end
  333.     if @type == 15 # user-defined
  334.       if $WEATHER_UPDATE
  335.         update_user_defined
  336.         $WEATHER_UPDATE = false
  337.       end
  338.       if $WEATHER_ANIMATED and @countarray[i] == 0
  339.         @current_pose[i] = (@current_pose[i] + 1) % @user_bitmaps.size
  340.         sprite.bitmap = @user_bitmaps[@current_pose[i]]
  341.       end
  342.       @countarray[i] = (@countarray[i] + 1) % 15
  343.       sprite.x += $WEATHER_X
  344.       sprite.y += $WEATHER_Y
  345.       sprite.opacity -= $WEATHER_FADE
  346.     end

  347.     x = sprite.x - @ox
  348.     y = sprite.y - @oy
  349.     if sprite.opacity < 64 or x < -50 or x > 750 or y < -300 or y > 500
  350.       sprite.x = rand(800) - 50 + @ox
  351.       sprite.y = rand(800) - 200 + @oy
  352.       sprite.opacity = 255
  353.     end
  354.   end
  355. end

  356. def make_bitmaps
  357.   color1 = Color.new(255, 255, 255, 255)
  358.   color2 = Color.new(255, 255, 255, 128)
  359.   @rain_bitmap = Bitmap.new(7, 56)
  360.   for i in 0..6
  361.     @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
  362.   end
  363.   @storm_bitmap = Bitmap.new(34, 64)
  364.   for i in 0..31
  365.     @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
  366.     @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
  367.     @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
  368.   end
  369.   @snow_bitmap = Bitmap.new(6, 6)
  370.   @snow_bitmap.fill_rect(0, 1, 6, 4, color2)
  371.   @snow_bitmap.fill_rect(1, 0, 4, 6, color2)
  372.   @snow_bitmap.fill_rect(1, 2, 4, 2, color1)
  373.   @snow_bitmap.fill_rect(2, 1, 2, 4, color1)
  374.   @sprites = []
  375.   
  376.   blueGrey  = Color.new(215, 227, 227, 150)
  377.   grey      = Color.new(214, 217, 217, 150)
  378.   lightGrey = Color.new(233, 233, 233, 250)
  379.   lightBlue = Color.new(222, 239, 243, 250)
  380.   @hail_bitmap = Bitmap.new(4, 4)
  381.   @hail_bitmap.fill_rect(1, 0, 2, 1, blueGrey)
  382.   @hail_bitmap.fill_rect(0, 1, 1, 2, blueGrey)
  383.   @hail_bitmap.fill_rect(3, 1, 1, 2, grey)
  384.   @hail_bitmap.fill_rect(1, 3, 2, 1, grey)
  385.   @hail_bitmap.fill_rect(1, 1, 2, 2, lightGrey)
  386.   @hail_bitmap.set_pixel(1, 1, lightBlue)
  387.   
  388.   
  389.   color3 = Color.new(255, 167, 192, 255) # light pink
  390.   color4 = Color.new(213, 106, 136, 255) # dark pink
  391.   @petal_bitmap = Bitmap.new(4, 4) #This creates a new bitmap that is 4 x 4 pixels
  392.   @petal_bitmap.fill_rect(0, 3, 1, 1, color3) # this makes a 1x1 pixel "rectangle" at the 0, 3 pixel of the image (upper left corner is 0, 0)
  393.   @petal_bitmap.fill_rect(1, 2, 1, 1, color3)
  394.   @petal_bitmap.fill_rect(2, 1, 1, 1, color3)
  395.   @petal_bitmap.fill_rect(3, 0, 1, 1, color3)
  396.   @petal_bitmap.fill_rect(1, 3, 1, 1, color4)
  397.   @petal_bitmap.fill_rect(2, 2, 1, 1, color4)
  398.   @petal_bitmap.fill_rect(3, 1, 1, 1, color4)
  399.   
  400.   
  401.   brightOrange = Color.new(248, 88, 0, 255)  
  402.   orangeBrown  = Color.new(144, 80, 56, 255)
  403.   burntRed     = Color.new(152, 0, 0, 255)
  404.   paleOrange   = Color.new(232, 160, 128, 255)
  405.   darkBrown    = Color.new(72, 40, 0, 255)
  406.   @autumn_leaf_bitmaps = []
  407.   @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  408.   # draw the first of the leaf1 bitmaps
  409.   @autumn_leaf_bitmaps[0].set_pixel(5, 1, orangeBrown)
  410.   @autumn_leaf_bitmaps[0].set_pixel(6, 1, brightOrange)
  411.   @autumn_leaf_bitmaps[0].set_pixel(7, 1, paleOrange)
  412.   @autumn_leaf_bitmaps[0].set_pixel(3, 2, orangeBrown)
  413.   @autumn_leaf_bitmaps[0].fill_rect(4, 2, 2, 1, brightOrange)
  414.   @autumn_leaf_bitmaps[0].set_pixel(6, 2, paleOrange)
  415.   @autumn_leaf_bitmaps[0].set_pixel(2, 3, orangeBrown)
  416.   @autumn_leaf_bitmaps[0].set_pixel(3, 3, brightOrange)
  417.   @autumn_leaf_bitmaps[0].fill_rect(4, 3, 2, 1, paleOrange)
  418.   @autumn_leaf_bitmaps[0].set_pixel(1, 4, orangeBrown)
  419.   @autumn_leaf_bitmaps[0].set_pixel(2, 4, brightOrange)
  420.   @autumn_leaf_bitmaps[0].set_pixel(3, 4, paleOrange)
  421.   @autumn_leaf_bitmaps[0].set_pixel(1, 5, brightOrange)
  422.   @autumn_leaf_bitmaps[0].set_pixel(2, 5, paleOrange)
  423.   @autumn_leaf_bitmaps[0].set_pixel(0, 6, orangeBrown)
  424.   @autumn_leaf_bitmaps[0].set_pixel(1, 6, paleOrange)
  425.   @autumn_leaf_bitmaps[0].set_pixel(0, 7, paleOrange)
  426.   
  427.   # draw the 2nd of the leaf1 bitmaps
  428.   @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  429.   @autumn_leaf_bitmaps[1].set_pixel(3, 0, brightOrange)
  430.   @autumn_leaf_bitmaps[1].set_pixel(7, 0, brightOrange)
  431.   @autumn_leaf_bitmaps[1].set_pixel(3, 1, orangeBrown)
  432.   @autumn_leaf_bitmaps[1].set_pixel(4, 1, burntRed)
  433.   @autumn_leaf_bitmaps[1].set_pixel(6, 1, brightOrange)
  434.   @autumn_leaf_bitmaps[1].set_pixel(0, 2, paleOrange)
  435.   @autumn_leaf_bitmaps[1].set_pixel(1, 2, brightOrange)
  436.   @autumn_leaf_bitmaps[1].set_pixel(2, 2, orangeBrown)
  437.   @autumn_leaf_bitmaps[1].set_pixel(3, 2, burntRed)
  438.   @autumn_leaf_bitmaps[1].set_pixel(4, 2, orangeBrown)
  439.   @autumn_leaf_bitmaps[1].set_pixel(5, 2, brightOrange)
  440.   @autumn_leaf_bitmaps[1].fill_rect(1, 3, 3, 1, orangeBrown)
  441.   @autumn_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, brightOrange)
  442.   @autumn_leaf_bitmaps[1].set_pixel(6, 3, orangeBrown)
  443.   @autumn_leaf_bitmaps[1].set_pixel(2, 4, burntRed)
  444.   @autumn_leaf_bitmaps[1].fill_rect(3, 4, 3, 1, brightOrange)
  445.   @autumn_leaf_bitmaps[1].set_pixel(6, 4, burntRed)
  446.   @autumn_leaf_bitmaps[1].set_pixel(7, 4, darkBrown)
  447.   @autumn_leaf_bitmaps[1].set_pixel(1, 5, orangeBrown)
  448.   @autumn_leaf_bitmaps[1].fill_rect(2, 5, 2, 1, brightOrange)
  449.   @autumn_leaf_bitmaps[1].set_pixel(4, 5, orangeBrown)
  450.   @autumn_leaf_bitmaps[1].set_pixel(5, 5, burntRed)
  451.   @autumn_leaf_bitmaps[1].fill_rect(1, 6, 2, 1, brightOrange)
  452.   @autumn_leaf_bitmaps[1].fill_rect(4, 6, 2, 1, burntRed)
  453.   @autumn_leaf_bitmaps[1].set_pixel(0, 7, brightOrange)
  454.   @autumn_leaf_bitmaps[1].set_pixel(5, 7, darkBrown)
  455.   
  456.   # draw the 3rd of the leaf1 bitmaps
  457.   @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  458.   @autumn_leaf_bitmaps[2].set_pixel(7, 1, paleOrange)
  459.   @autumn_leaf_bitmaps[2].set_pixel(6, 2, paleOrange)
  460.   @autumn_leaf_bitmaps[2].set_pixel(7, 2, orangeBrown)
  461.   @autumn_leaf_bitmaps[2].set_pixel(5, 3, paleOrange)
  462.   @autumn_leaf_bitmaps[2].set_pixel(6, 3, brightOrange)
  463.   @autumn_leaf_bitmaps[2].set_pixel(4, 4, paleOrange)
  464.   @autumn_leaf_bitmaps[2].set_pixel(5, 4, brightOrange)
  465.   @autumn_leaf_bitmaps[2].set_pixel(6, 4, orangeBrown)
  466.   @autumn_leaf_bitmaps[2].fill_rect(2, 5, 2, 1, paleOrange)
  467.   @autumn_leaf_bitmaps[2].set_pixel(4, 5, brightOrange)
  468.   @autumn_leaf_bitmaps[2].set_pixel(5, 5, orangeBrown)
  469.   @autumn_leaf_bitmaps[2].set_pixel(1, 6, paleOrange)
  470.   @autumn_leaf_bitmaps[2].fill_rect(2, 6, 2, 1, brightOrange)
  471.   @autumn_leaf_bitmaps[2].set_pixel(4, 6, orangeBrown)
  472.   @autumn_leaf_bitmaps[2].set_pixel(0, 7, paleOrange)
  473.   @autumn_leaf_bitmaps[2].set_pixel(1, 7, brightOrange)
  474.   @autumn_leaf_bitmaps[2].set_pixel(2, 7, orangeBrown)
  475.   
  476.   # draw the 4th of the leaf1 bitmaps
  477.   @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  478.   @autumn_leaf_bitmaps[3].set_pixel(3, 0, brightOrange)
  479.   @autumn_leaf_bitmaps[3].set_pixel(7, 0, brightOrange)
  480.   @autumn_leaf_bitmaps[3].set_pixel(3, 1, orangeBrown)
  481.   @autumn_leaf_bitmaps[3].set_pixel(4, 1, burntRed)
  482.   @autumn_leaf_bitmaps[3].set_pixel(6, 1, brightOrange)
  483.   @autumn_leaf_bitmaps[3].set_pixel(0, 2, paleOrange)
  484.   @autumn_leaf_bitmaps[3].set_pixel(1, 2, brightOrange)
  485.   @autumn_leaf_bitmaps[3].set_pixel(2, 2, orangeBrown)
  486.   @autumn_leaf_bitmaps[3].set_pixel(3, 2, burntRed)
  487.   @autumn_leaf_bitmaps[3].set_pixel(4, 2, orangeBrown)
  488.   @autumn_leaf_bitmaps[3].set_pixel(5, 2, brightOrange)
  489.   @autumn_leaf_bitmaps[3].fill_rect(1, 3, 3, 1, orangeBrown)
  490.   @autumn_leaf_bitmaps[3].fill_rect(4, 3, 2, 1, brightOrange)
  491.   @autumn_leaf_bitmaps[3].set_pixel(6, 3, orangeBrown)
  492.   @autumn_leaf_bitmaps[3].set_pixel(2, 4, burntRed)
  493.   @autumn_leaf_bitmaps[3].fill_rect(3, 4, 3, 1, brightOrange)
  494.   @autumn_leaf_bitmaps[3].set_pixel(6, 4, burntRed)
  495.   @autumn_leaf_bitmaps[3].set_pixel(7, 4, darkBrown)
  496.   @autumn_leaf_bitmaps[3].set_pixel(1, 5, orangeBrown)
  497.   @autumn_leaf_bitmaps[3].fill_rect(2, 5, 2, 1, brightOrange)
  498.   @autumn_leaf_bitmaps[3].set_pixel(4, 5, orangeBrown)
  499.   @autumn_leaf_bitmaps[3].set_pixel(5, 5, burntRed)
  500.   @autumn_leaf_bitmaps[3].fill_rect(1, 6, 2, 1, brightOrange)
  501.   @autumn_leaf_bitmaps[3].fill_rect(4, 6, 2, 1, burntRed)
  502.   @autumn_leaf_bitmaps[3].set_pixel(0, 7, brightOrange)
  503.   @autumn_leaf_bitmaps[3].set_pixel(5, 7, darkBrown)
  504.   
  505.   @green_leaf_bitmaps = []
  506.   darkGreen  = Color.new(62, 76, 31, 255)
  507.   midGreen   = Color.new(76, 91, 43, 255)
  508.   khaki      = Color.new(105, 114, 66, 255)
  509.   lightGreen = Color.new(128, 136, 88, 255)
  510.   mint       = Color.new(146, 154, 106, 255)
  511.   
  512.   # 1st leaf bitmap
  513.   @green_leaf_bitmaps[0] = Bitmap.new(8, 8)
  514.   @green_leaf_bitmaps[0].set_pixel(1, 0, darkGreen)
  515.   @green_leaf_bitmaps[0].set_pixel(1, 1, midGreen)
  516.   @green_leaf_bitmaps[0].set_pixel(2, 1, darkGreen)
  517.   @green_leaf_bitmaps[0].set_pixel(2, 2, khaki)
  518.   @green_leaf_bitmaps[0].set_pixel(3, 2, darkGreen)
  519.   @green_leaf_bitmaps[0].set_pixel(4, 2, khaki)
  520.   @green_leaf_bitmaps[0].fill_rect(2, 3, 3, 1, midGreen)
  521.   @green_leaf_bitmaps[0].set_pixel(5, 3, khaki)
  522.   @green_leaf_bitmaps[0].fill_rect(2, 4, 2, 1, midGreen)
  523.   @green_leaf_bitmaps[0].set_pixel(4, 4, darkGreen)
  524.   @green_leaf_bitmaps[0].set_pixel(5, 4, lightGreen)
  525.   @green_leaf_bitmaps[0].set_pixel(6, 4, khaki)
  526.   @green_leaf_bitmaps[0].set_pixel(3, 5, midGreen)
  527.   @green_leaf_bitmaps[0].set_pixel(4, 5, darkGreen)
  528.   @green_leaf_bitmaps[0].set_pixel(5, 5, khaki)
  529.   @green_leaf_bitmaps[0].set_pixel(6, 5, lightGreen)
  530.   @green_leaf_bitmaps[0].set_pixel(4, 6, midGreen)
  531.   @green_leaf_bitmaps[0].set_pixel(5, 6, darkGreen)
  532.   @green_leaf_bitmaps[0].set_pixel(6, 6, lightGreen)
  533.   @green_leaf_bitmaps[0].set_pixel(6, 7, khaki)
  534.   
  535.   # 2nd leaf bitmap
  536.   @green_leaf_bitmaps[1] = Bitmap.new(8, 8)
  537.   @green_leaf_bitmaps[1].fill_rect(1, 1, 1, 2, midGreen)
  538.   @green_leaf_bitmaps[1].fill_rect(2, 2, 2, 1, khaki)
  539.   @green_leaf_bitmaps[1].set_pixel(4, 2, lightGreen)
  540.   @green_leaf_bitmaps[1].fill_rect(2, 3, 2, 1, darkGreen)
  541.   @green_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, lightGreen)
  542.   @green_leaf_bitmaps[1].set_pixel(2, 4, midGreen)
  543.   @green_leaf_bitmaps[1].set_pixel(3, 4, darkGreen)
  544.   @green_leaf_bitmaps[1].set_pixel(4, 4, khaki)
  545.   @green_leaf_bitmaps[1].fill_rect(5, 4, 2, 1, lightGreen)
  546.   @green_leaf_bitmaps[1].set_pixel(3, 5, midGreen)
  547.   @green_leaf_bitmaps[1].set_pixel(4, 5, darkGreen)
  548.   @green_leaf_bitmaps[1].set_pixel(5, 5, khaki)
  549.   @green_leaf_bitmaps[1].set_pixel(6, 5, lightGreen)
  550.   @green_leaf_bitmaps[1].set_pixel(5, 6, darkGreen)
  551.   @green_leaf_bitmaps[1].fill_rect(6, 6, 2, 1, khaki)
  552.   
  553.   # 3rd leaf bitmap
  554.   @green_leaf_bitmaps[2] = Bitmap.new(8, 8)
  555.   @green_leaf_bitmaps[2].set_pixel(1, 1, darkGreen)
  556.   @green_leaf_bitmaps[2].fill_rect(1, 2, 2, 1, midGreen)
  557.   @green_leaf_bitmaps[2].set_pixel(2, 3, midGreen)
  558.   @green_leaf_bitmaps[2].set_pixel(3, 3, darkGreen)
  559.   @green_leaf_bitmaps[2].set_pixel(4, 3, midGreen)
  560.   @green_leaf_bitmaps[2].fill_rect(2, 4, 2, 1, midGreen)
  561.   @green_leaf_bitmaps[2].set_pixel(4, 4, darkGreen)
  562.   @green_leaf_bitmaps[2].set_pixel(5, 4, lightGreen)
  563.   @green_leaf_bitmaps[2].set_pixel(3, 5, midGreen)
  564.   @green_leaf_bitmaps[2].set_pixel(4, 5, darkGreen)
  565.   @green_leaf_bitmaps[2].fill_rect(5, 5, 2, 1, khaki)
  566.   @green_leaf_bitmaps[2].fill_rect(4, 6, 2, 1, midGreen)
  567.   @green_leaf_bitmaps[2].set_pixel(6, 6, lightGreen)
  568.   @green_leaf_bitmaps[2].set_pixel(6, 7, khaki)
  569.   
  570.   # 4th leaf bitmap
  571.   @green_leaf_bitmaps[3] = Bitmap.new(8, 8)
  572.   @green_leaf_bitmaps[3].fill_rect(0, 3, 1, 2, darkGreen)
  573.   @green_leaf_bitmaps[3].set_pixel(1, 4, midGreen)
  574.   @green_leaf_bitmaps[3].set_pixel(2, 4, khaki)
  575.   @green_leaf_bitmaps[3].set_pixel(3, 4, lightGreen)
  576.   @green_leaf_bitmaps[3].set_pixel(4, 4, darkGreen)
  577.   @green_leaf_bitmaps[3].set_pixel(7, 4, midGreen)
  578.   @green_leaf_bitmaps[3].set_pixel(1, 5, darkGreen)
  579.   @green_leaf_bitmaps[3].set_pixel(2, 5, midGreen)
  580.   @green_leaf_bitmaps[3].set_pixel(3, 5, lightGreen)
  581.   @green_leaf_bitmaps[3].set_pixel(4, 5, mint)
  582.   @green_leaf_bitmaps[3].set_pixel(5, 5, lightGreen)
  583.   @green_leaf_bitmaps[3].set_pixel(6, 5, khaki)
  584.   @green_leaf_bitmaps[3].set_pixel(7, 5, midGreen)
  585.   @green_leaf_bitmaps[3].fill_rect(2, 6, 2, 1, midGreen)
  586.   @green_leaf_bitmaps[3].set_pixel(4, 6, lightGreen)
  587.   @green_leaf_bitmaps[3].set_pixel(5, 6, khaki)
  588.   @green_leaf_bitmaps[3].set_pixel(6, 6, midGreen)
  589.   
  590.   # 5th leaf bitmap
  591.   @green_leaf_bitmaps[4] = Bitmap.new(8, 8)
  592.   @green_leaf_bitmaps[4].set_pixel(6, 2, midGreen)
  593.   @green_leaf_bitmaps[4].set_pixel(7, 2, darkGreen)
  594.   @green_leaf_bitmaps[4].fill_rect(4, 3, 2, 1, midGreen)
  595.   @green_leaf_bitmaps[4].set_pixel(6, 3, khaki)
  596.   @green_leaf_bitmaps[4].set_pixel(2, 4, darkGreen)
  597.   @green_leaf_bitmaps[4].fill_rect(3, 4, 2, 1, khaki)
  598.   @green_leaf_bitmaps[4].set_pixel(5, 4, lightGreen)
  599.   @green_leaf_bitmaps[4].set_pixel(6, 4, khaki)
  600.   @green_leaf_bitmaps[4].set_pixel(1, 5, midGreen)
  601.   @green_leaf_bitmaps[4].set_pixel(2, 5, khaki)
  602.   @green_leaf_bitmaps[4].set_pixel(3, 5, lightGreen)
  603.   @green_leaf_bitmaps[4].set_pixel(4, 5, mint)
  604.   @green_leaf_bitmaps[4].set_pixel(5, 5, midGreen)
  605.   @green_leaf_bitmaps[4].set_pixel(2, 6, darkGreen)
  606.   @green_leaf_bitmaps[4].fill_rect(3, 6, 2, 1, midGreen)
  607.   
  608.   # 6th leaf bitmap
  609.   @green_leaf_bitmaps[5] = Bitmap.new(8, 8)
  610.   @green_leaf_bitmaps[5].fill_rect(6, 2, 2, 1, midGreen)
  611.   @green_leaf_bitmaps[5].fill_rect(4, 3, 2, 1, midGreen)
  612.   @green_leaf_bitmaps[5].set_pixel(6, 3, khaki)
  613.   @green_leaf_bitmaps[5].set_pixel(3, 4, midGreen)
  614.   @green_leaf_bitmaps[5].set_pixel(4, 4, khaki)
  615.   @green_leaf_bitmaps[5].set_pixel(5, 4, lightGreen)
  616.   @green_leaf_bitmaps[5].set_pixel(6, 4, mint)
  617.   @green_leaf_bitmaps[5].set_pixel(1, 5, midGreen)
  618.   @green_leaf_bitmaps[5].set_pixel(2, 5, khaki)
  619.   @green_leaf_bitmaps[5].fill_rect(3, 5, 2, 1, mint)
  620.   @green_leaf_bitmaps[5].set_pixel(5, 5, lightGreen)
  621.   @green_leaf_bitmaps[5].set_pixel(2, 6, midGreen)
  622.   @green_leaf_bitmaps[5].set_pixel(3, 6, khaki)
  623.   @green_leaf_bitmaps[5].set_pixel(4, 6, lightGreen)
  624.   
  625.   # 7th leaf bitmap
  626.   @green_leaf_bitmaps[6] = Bitmap.new(8, 8)
  627.   @green_leaf_bitmaps[6].fill_rect(6, 1, 1, 2, midGreen)
  628.   @green_leaf_bitmaps[6].fill_rect(4, 2, 2, 1, midGreen)
  629.   @green_leaf_bitmaps[6].fill_rect(6, 2, 1, 2, darkGreen)
  630.   @green_leaf_bitmaps[6].fill_rect(3, 3, 2, 1, midGreen)
  631.   @green_leaf_bitmaps[6].set_pixel(5, 3, khaki)
  632.   @green_leaf_bitmaps[6].set_pixel(2, 4, midGreen)
  633.   @green_leaf_bitmaps[6].set_pixel(3, 4, khaki)
  634.   @green_leaf_bitmaps[6].set_pixel(4, 4, lightGreen)
  635.   @green_leaf_bitmaps[6].set_pixel(5, 4, midGreen)
  636.   @green_leaf_bitmaps[6].set_pixel(1, 5, midGreen)
  637.   @green_leaf_bitmaps[6].set_pixel(2, 5, khaki)
  638.   @green_leaf_bitmaps[6].fill_rect(3, 5, 2, 1, midGreen)
  639.   @green_leaf_bitmaps[6].set_pixel(1, 6, darkGreen)
  640.   @green_leaf_bitmaps[6].set_pixel(2, 6, midGreen)
  641.   
  642.   # 8th leaf bitmap
  643.   @green_leaf_bitmaps[7] = Bitmap.new(8, 8)
  644.   @green_leaf_bitmaps[7].set_pixel(6, 1, midGreen)
  645.   @green_leaf_bitmaps[7].fill_rect(4, 2, 3, 2, midGreen)
  646.   @green_leaf_bitmaps[7].set_pixel(3, 3, darkGreen)
  647.   @green_leaf_bitmaps[7].set_pixel(2, 4, darkGreen)
  648.   @green_leaf_bitmaps[7].set_pixel(3, 4, midGreen)
  649.   @green_leaf_bitmaps[7].fill_rect(4, 4, 2, 1, khaki)
  650.   @green_leaf_bitmaps[7].set_pixel(1, 5, darkGreen)
  651.   @green_leaf_bitmaps[7].set_pixel(2, 5, midGreen)
  652.   @green_leaf_bitmaps[7].fill_rect(3, 5, 2, 1, lightGreen)
  653.   @green_leaf_bitmaps[7].set_pixel(2, 6, midGreen)
  654.   @green_leaf_bitmaps[7].set_pixel(3, 6, lightGreen)
  655.   
  656.   # 9th leaf bitmap
  657.   @green_leaf_bitmaps[8] = Bitmap.new(8, 8)
  658.   @green_leaf_bitmaps[8].fill_rect(6, 1, 1, 2, midGreen)
  659.   @green_leaf_bitmaps[8].fill_rect(4, 2, 2, 1, midGreen)
  660.   @green_leaf_bitmaps[8].fill_rect(6, 2, 1, 2, darkGreen)
  661.   @green_leaf_bitmaps[8].fill_rect(3, 3, 2, 1, midGreen)
  662.   @green_leaf_bitmaps[8].set_pixel(5, 3, khaki)
  663.   @green_leaf_bitmaps[8].set_pixel(2, 4, midGreen)
  664.   @green_leaf_bitmaps[8].set_pixel(3, 4, khaki)
  665.   @green_leaf_bitmaps[8].set_pixel(4, 4, lightGreen)
  666.   @green_leaf_bitmaps[8].set_pixel(5, 4, midGreen)
  667.   @green_leaf_bitmaps[8].set_pixel(1, 5, midGreen)
  668.   @green_leaf_bitmaps[8].set_pixel(2, 5, khaki)
  669.   @green_leaf_bitmaps[8].fill_rect(3, 5, 2, 1, midGreen)
  670.   @green_leaf_bitmaps[8].set_pixel(1, 6, darkGreen)
  671.   @green_leaf_bitmaps[8].set_pixel(2, 6, midGreen)
  672.   
  673.   # 10th leaf bitmap
  674.   @green_leaf_bitmaps[9] = Bitmap.new(8, 8)
  675.   @green_leaf_bitmaps[9].fill_rect(6, 2, 2, 1, midGreen)
  676.   @green_leaf_bitmaps[9].fill_rect(4, 3, 2, 1, midGreen)
  677.   @green_leaf_bitmaps[9].set_pixel(6, 3, khaki)
  678.   @green_leaf_bitmaps[9].set_pixel(3, 4, midGreen)
  679.   @green_leaf_bitmaps[9].set_pixel(4, 4, khaki)
  680.   @green_leaf_bitmaps[9].set_pixel(5, 4, lightGreen)
  681.   @green_leaf_bitmaps[9].set_pixel(6, 4, mint)
  682.   @green_leaf_bitmaps[9].set_pixel(1, 5, midGreen)
  683.   @green_leaf_bitmaps[9].set_pixel(2, 5, khaki)
  684.   @green_leaf_bitmaps[9].fill_rect(3, 5, 2, 1, mint)
  685.   @green_leaf_bitmaps[9].set_pixel(5, 5, lightGreen)
  686.   @green_leaf_bitmaps[9].set_pixel(2, 6, midGreen)
  687.   @green_leaf_bitmaps[9].set_pixel(3, 6, khaki)
  688.   @green_leaf_bitmaps[9].set_pixel(4, 6, lightGreen)
  689.   
  690.   # 11th leaf bitmap
  691.   @green_leaf_bitmaps[10] = Bitmap.new(8, 8)
  692.   @green_leaf_bitmaps[10].set_pixel(6, 2, midGreen)
  693.   @green_leaf_bitmaps[10].set_pixel(7, 2, darkGreen)
  694.   @green_leaf_bitmaps[10].fill_rect(4, 3, 2, 1, midGreen)
  695.   @green_leaf_bitmaps[10].set_pixel(6, 3, khaki)
  696.   @green_leaf_bitmaps[10].set_pixel(2, 4, darkGreen)
  697.   @green_leaf_bitmaps[10].fill_rect(3, 4, 2, 1, khaki)
  698.   @green_leaf_bitmaps[10].set_pixel(5, 4, lightGreen)
  699.   @green_leaf_bitmaps[10].set_pixel(6, 4, khaki)
  700.   @green_leaf_bitmaps[10].set_pixel(1, 5, midGreen)
  701.   @green_leaf_bitmaps[10].set_pixel(2, 5, khaki)
  702.   @green_leaf_bitmaps[10].set_pixel(3, 5, lightGreen)
  703.   @green_leaf_bitmaps[10].set_pixel(4, 5, mint)
  704.   @green_leaf_bitmaps[10].set_pixel(5, 5, midGreen)
  705.   @green_leaf_bitmaps[10].set_pixel(2, 6, darkGreen)
  706.   @green_leaf_bitmaps[10].fill_rect(3, 6, 2, 1, midGreen)
  707.   
  708.   # 12th leaf bitmap
  709.   @green_leaf_bitmaps[11] = Bitmap.new(8, 8)
  710.   @green_leaf_bitmaps[11].fill_rect(0, 3, 1, 2, darkGreen)
  711.   @green_leaf_bitmaps[11].set_pixel(1, 4, midGreen)
  712.   @green_leaf_bitmaps[11].set_pixel(2, 4, khaki)
  713.   @green_leaf_bitmaps[11].set_pixel(3, 4, lightGreen)
  714.   @green_leaf_bitmaps[11].set_pixel(4, 4, darkGreen)
  715.   @green_leaf_bitmaps[11].set_pixel(7, 4, midGreen)
  716.   @green_leaf_bitmaps[11].set_pixel(1, 5, darkGreen)
  717.   @green_leaf_bitmaps[11].set_pixel(2, 5, midGreen)
  718.   @green_leaf_bitmaps[11].set_pixel(3, 5, lightGreen)
  719.   @green_leaf_bitmaps[11].set_pixel(4, 5, mint)
  720.   @green_leaf_bitmaps[11].set_pixel(5, 5, lightGreen)
  721.   @green_leaf_bitmaps[11].set_pixel(6, 5, khaki)
  722.   @green_leaf_bitmaps[11].set_pixel(7, 5, midGreen)
  723.   @green_leaf_bitmaps[11].fill_rect(2, 6, 2, 1, midGreen)
  724.   @green_leaf_bitmaps[11].set_pixel(4, 6, lightGreen)
  725.   @green_leaf_bitmaps[11].set_pixel(5, 6, khaki)
  726.   @green_leaf_bitmaps[11].set_pixel(6, 6, midGreen)
  727.   
  728.   # 13th leaf bitmap
  729.   @green_leaf_bitmaps[12] = Bitmap.new(8, 8)
  730.   @green_leaf_bitmaps[12].set_pixel(1, 1, darkGreen)
  731.   @green_leaf_bitmaps[12].fill_rect(1, 2, 2, 1, midGreen)
  732.   @green_leaf_bitmaps[12].set_pixel(2, 3, midGreen)
  733.   @green_leaf_bitmaps[12].set_pixel(3, 3, darkGreen)
  734.   @green_leaf_bitmaps[12].set_pixel(4, 3, midGreen)
  735.   @green_leaf_bitmaps[12].fill_rect(2, 4, 2, 1, midGreen)
  736.   @green_leaf_bitmaps[12].set_pixel(4, 4, darkGreen)
  737.   @green_leaf_bitmaps[12].set_pixel(5, 4, lightGreen)
  738.   @green_leaf_bitmaps[12].set_pixel(3, 5, midGreen)
  739.   @green_leaf_bitmaps[12].set_pixel(4, 5, darkGreen)
  740.   @green_leaf_bitmaps[12].fill_rect(5, 5, 2, 1, khaki)
  741.   @green_leaf_bitmaps[12].fill_rect(4, 6, 2, 1, midGreen)
  742.   @green_leaf_bitmaps[12].set_pixel(6, 6, lightGreen)
  743.   @green_leaf_bitmaps[12].set_pixel(6, 7, khaki)
  744.   
  745.   @rose_bitmaps = []
  746.   brightRed = Color.new(255, 0, 0, 255)
  747.   midRed    = Color.new(179, 17, 17, 255)
  748.   darkRed   = Color.new(141, 9, 9, 255)
  749.   
  750.   # 1st rose petal bitmap
  751.   @rose_bitmaps[0] = Bitmap.new(3, 3)
  752.   @rose_bitmaps[0].fill_rect(1, 0, 2, 1, brightRed)
  753.   @rose_bitmaps[0].fill_rect(0, 1, 1, 2, brightRed)
  754.   @rose_bitmaps[0].fill_rect(1, 1, 2, 2, midRed)
  755.   @rose_bitmaps[0].set_pixel(2, 2, darkRed)
  756.   
  757.   # 2nd rose petal bitmap
  758.   @rose_bitmaps[1] = Bitmap.new(3, 3)
  759.   @rose_bitmaps[1].set_pixel(0, 1, midRed)
  760.   @rose_bitmaps[1].set_pixel(1, 1, brightRed)
  761.   @rose_bitmaps[1].fill_rect(1, 2, 1, 2, midRed)
  762.   
  763.   @feather_bitmaps = []
  764.   white = Color.new(255, 255, 255, 255)
  765.   
  766.   # 1st feather bitmap
  767.   @feather_bitmaps[0] = Bitmap.new(3, 3)
  768.   @feather_bitmaps[0].set_pixel(0, 2, white)
  769.   @feather_bitmaps[0].set_pixel(1, 2, grey)
  770.   @feather_bitmaps[0].set_pixel(2, 1, grey)
  771.   
  772.   # 2nd feather bitmap
  773.   @feather_bitmaps[0] = Bitmap.new(3, 3)
  774.   @feather_bitmaps[0].set_pixel(0, 0, white)
  775.   @feather_bitmaps[0].set_pixel(0, 1, grey)
  776.   @feather_bitmaps[0].set_pixel(1, 2, grey)
  777.   
  778.   # 3rd feather bitmap
  779.   @feather_bitmaps[0] = Bitmap.new(3, 3)
  780.   @feather_bitmaps[0].set_pixel(2, 0, white)
  781.   @feather_bitmaps[0].set_pixel(1, 0, grey)
  782.   @feather_bitmaps[0].set_pixel(0, 1, grey)
  783.   
  784.   # 4th feather bitmap
  785.   @feather_bitmaps[0] = Bitmap.new(3, 3)
  786.   @feather_bitmaps[0].set_pixel(2, 2, white)
  787.   @feather_bitmaps[0].set_pixel(2, 1, grey)
  788.   @feather_bitmaps[0].set_pixel(1, 0, grey)
  789.   
  790.   @blood_rain_bitmap = Bitmap.new(7, 56)
  791.   for i in 0..6
  792.     @blood_rain_bitmap.fill_rect(6-i, i*8, 1, 8, darkRed)
  793.   end
  794.   
  795.   @sparkle_bitmaps = []
  796.   
  797.   lightBlue = Color.new(181, 244, 255, 255)
  798.   midBlue   = Color.new(126, 197, 235, 255)
  799.   darkBlue  = Color.new(77, 136, 225, 255)
  800.   
  801.   # 1st sparkle bitmap
  802.   @sparkle_bitmaps[0] = Bitmap.new(7, 7)
  803.   @sparkle_bitmaps[0].set_pixel(3, 3, darkBlue)
  804.   
  805.   # 2nd sparkle bitmap
  806.   @sparkle_bitmaps[1] = Bitmap.new(7, 7)
  807.   @sparkle_bitmaps[1].fill_rect(3, 2, 1, 3, darkBlue)
  808.   @sparkle_bitmaps[1].fill_rect(2, 3, 3, 1, darkBlue)
  809.   @sparkle_bitmaps[1].set_pixel(3, 3, midBlue)
  810.   
  811.   # 3rd sparkle bitmap
  812.   @sparkle_bitmaps[2] = Bitmap.new(7, 7)
  813.   @sparkle_bitmaps[2].set_pixel(1, 1, darkBlue)
  814.   @sparkle_bitmaps[2].set_pixel(5, 1, darkBlue)
  815.   @sparkle_bitmaps[2].set_pixel(2, 2, midBlue)
  816.   @sparkle_bitmaps[2].set_pixel(4, 2, midBlue)
  817.   @sparkle_bitmaps[2].set_pixel(3, 3, lightBlue)
  818.   @sparkle_bitmaps[2].set_pixel(2, 4, midBlue)
  819.   @sparkle_bitmaps[2].set_pixel(4, 4, midBlue)
  820.   @sparkle_bitmaps[2].set_pixel(1, 5, darkBlue)
  821.   @sparkle_bitmaps[2].set_pixel(5, 5, darkBlue)
  822.   
  823.   # 4th sparkle bitmap
  824.   @sparkle_bitmaps[3] = Bitmap.new(7, 7)
  825.   @sparkle_bitmaps[3].fill_rect(3, 1, 1, 5, darkBlue)
  826.   @sparkle_bitmaps[3].fill_rect(1, 3, 5, 1, darkBlue)
  827.   @sparkle_bitmaps[3].fill_rect(3, 2, 1, 3, midBlue)
  828.   @sparkle_bitmaps[3].fill_rect(2, 3, 3, 1, midBlue)
  829.   @sparkle_bitmaps[3].set_pixel(3, 3, lightBlue)
  830.   
  831.   # 5th sparkle bitmap
  832.   @sparkle_bitmaps[4] = Bitmap.new(7, 7)
  833.   @sparkle_bitmaps[4].fill_rect(2, 2, 3, 3, midBlue)
  834.   @sparkle_bitmaps[4].fill_rect(3, 2, 1, 3, darkBlue)
  835.   @sparkle_bitmaps[4].fill_rect(2, 3, 3, 1, darkBlue)
  836.   @sparkle_bitmaps[4].set_pixel(3, 3, lightBlue)
  837.   @sparkle_bitmaps[4].set_pixel(1, 1, darkBlue)
  838.   @sparkle_bitmaps[4].set_pixel(5, 1, darkBlue)
  839.   @sparkle_bitmaps[4].set_pixel(1, 5, darkBlue)
  840.   @sparkle_bitmaps[4].set_pixel(5, 1, darkBlue)
  841.   
  842.   # 6th sparkle bitmap
  843.   @sparkle_bitmaps[5] = Bitmap.new(7, 7)
  844.   @sparkle_bitmaps[5].fill_rect(2, 1, 3, 5, darkBlue)
  845.   @sparkle_bitmaps[5].fill_rect(1, 2, 5, 3, darkBlue)
  846.   @sparkle_bitmaps[5].fill_rect(2, 2, 3, 3, midBlue)
  847.   @sparkle_bitmaps[5].fill_rect(3, 1, 1, 5, midBlue)
  848.   @sparkle_bitmaps[5].fill_rect(1, 3, 5, 1, midBlue)
  849.   @sparkle_bitmaps[5].fill_rect(3, 2, 1, 3, lightBlue)
  850.   @sparkle_bitmaps[5].fill_rect(2, 3, 3, 1, lightBlue)
  851.   @sparkle_bitmaps[5].set_pixel(3, 3, white)
  852.   
  853.   # 7th sparkle bitmap
  854.   @sparkle_bitmaps[6] = Bitmap.new(7, 7)
  855.   @sparkle_bitmaps[6].fill_rect(2, 1, 3, 5, midBlue)
  856.   @sparkle_bitmaps[6].fill_rect(1, 2, 5, 3, midBlue)
  857.   @sparkle_bitmaps[6].fill_rect(3, 0, 1, 7, darkBlue)
  858.   @sparkle_bitmaps[6].fill_rect(0, 3, 7, 1, darkBlue)
  859.   @sparkle_bitmaps[6].fill_rect(2, 2, 3, 3, lightBlue)
  860.   @sparkle_bitmaps[6].fill_rect(3, 2, 1, 3, midBlue)
  861.   @sparkle_bitmaps[6].fill_rect(2, 3, 3, 1, midBlue)
  862.   @sparkle_bitmaps[6].set_pixel(3, 3, white)
  863.   
  864.   @user_bitmaps = []
  865.   update_user_defined
  866. end

  867. def update_user_defined
  868.   for image in @user_bitmaps
  869.     image.dispose
  870.   end
  871.   
  872.   #user-defined bitmaps
  873.   for name in $WEATHER_IMAGES
  874.     @user_bitmaps.push(RPG::Cache.picture(name))
  875.   end
  876.   for sprite in @sprites
  877.     sprite.bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
  878.   end
  879. end

  880. attr_reader :type
  881. attr_reader :max
  882. attr_reader :ox
  883. attr_reader :oy
  884. end
  885. end

复制代码
夏娜天气


作者: daxuexinsheng    时间: 2012-6-17 10:29
本帖最后由 daxuexinsheng 于 2012-6-17 11:12 编辑

这是流星天气脚本
  1. module RPG
  2. class Weather
  3. #--------------------------------------------------------------------------
  4. # ● 初始化物件
  5. #--------------------------------------------------------------------------
  6.    def initialize(viewport = nil)
  7.      # 天气类型
  8.      @type = 0
  9.      @max = 0
  10.      @ox = 0
  11.      @oy = 0
  12.      color1 = Color.new(255, 255, 255, 255)
  13.      color2 = Color.new(255, 255, 255, 128)
  14.      # 雨
  15.      @rain_bitmap = Bitmap.new(7, 30)
  16.      for i in 0..6
  17.        @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
  18.        @rain_bitmap.fill_rect(5-i, i*10, 1, 8, color2)
  19.      end
  20.      # 风
  21.      @storm_bitmap = Bitmap.new(34, 64)
  22.      for i in 0..31
  23.        @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
  24.        @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
  25.        @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
  26.      end
  27.      # 雪
  28.      @snow_bitmap = Bitmap.new(6, 6)
  29.      @snow_bitmap.fill_rect(0, 1, 6, 4, color2)
  30.      @snow_bitmap.fill_rect(1, 0, 4, 6, color2)
  31.      @snow_bitmap.fill_rect(1, 2, 4, 2, color1)
  32.      @snow_bitmap.fill_rect(2, 1, 2, 4, color1)
  33.      # 流星
  34.      @Hail_bitmap = Bitmap.new("Graphics/Pictures/star")
  35.      @sprites = []
  36.      for i in 1..40
  37.        sprite = Sprite.new(viewport)
  38.        sprite.z = 1000
  39.        sprite.visible = false
  40.        sprite.opacity = 0
  41.        @sprites.push(sprite)
  42.        # for
  43.      end
  44.      # initialize
  45.    end
  46. #--------------------------------------------------------------------------
  47. # ● 设定天气类型
  48. #--------------------------------------------------------------------------
  49.    def type=(type)
  50.      return if @type == type
  51.      @type = type
  52.      # 分歧-天气类型
  53.      case @type
  54.      # 雨
  55.      when 1
  56.        bitmap = @rain_bitmap
  57.        # 风
  58.      when 2
  59.        bitmap = @storm_bitmap
  60.        # 雪
  61.      when 3
  62.        bitmap = @snow_bitmap
  63.        # 流星
  64.      when 4
  65.        bitmap = @Hail_bitmap
  66.        # 类型在 1234 以外的场合
  67.      else
  68.        # bitmap = 空
  69.        bitmap = nil
  70.      end
  71.      for i in 1..40
  72.        sprite = @sprites[i]
  73.        # 如bitmap非空
  74.        if sprite != nil
  75.          sprite.visible = (i <= @max)
  76.          sprite.bitmap = bitmap
  77.        end
  78.      end
  79.    end
  80. #--------------------------------------------------------------------------
  81. # ● 更新画面
  82. #--------------------------------------------------------------------------
  83.    def update
  84.      # 如天气类型等于 0 则返回
  85.      return if @type == 0
  86.      for i in 1..@max
  87.        sprite = @sprites[i]
  88.        # 如sprite等于空
  89.        if sprite == nil
  90.          # 中断循环
  91.          break
  92.        end
  93.        # 如天气类型等于 1
  94.        if @type == 1
  95.          sprite.x -= 2
  96.          sprite.y += 16
  97.          sprite.opacity -= 8
  98.        end
  99.        # 如天气类型等于 2
  100.        if @type == 2
  101.          sprite.x -= 8
  102.          sprite.y += 16
  103.          sprite.opacity -= 12
  104.        end
  105.        # 如天气类型等于 3
  106.        if @type == 3
  107.          sprite.x -= 2
  108.          sprite.y += 8
  109.          sprite.opacity -= 8
  110.        end
  111.        # 如天气类型等于 4
  112.        if @type == 4
  113.          sprite.x -= 5
  114.          sprite.y += 5
  115.          sprite.opacity -= 2
  116.        end
  117.        x = sprite.x - @ox
  118.        y = sprite.y - @oy
  119.        # 如天气图片不透明度小于 64 或 x 小于 -50 或 x 大于 750 或 y 小于 -300 或 y 大于 500
  120.        if sprite.opacity < 64 or x < -50 or x > 750 or y < -300 or y > 500
  121.        case @type
  122.       when 4
  123.          # 图片不透明度x,y,不透明度调整
  124.          sprite.x = rand(1200) + 100 + @ox
  125.          sprite.y = rand(600) - 600 + @oy
  126.          sprite.opacity = 255
  127.        else
  128.         sprite.x = rand(800) - 50 + @ox
  129.          sprite.y = rand(800) - 200 + @oy
  130.          sprite.opacity = 255
  131.             end
  132.          # if
  133.        end
  134.        # for
  135.      end
  136.      #update
  137.    end
  138.    # class
  139. end
  140. #module
  141. end
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1