设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1256|回复: 3
打印 上一主题 下一主题

[已经过期] 请问窗口倒映下来的光这类素材要在哪里找?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
410
在线时间
2 小时
注册时间
2014-4-15
帖子
3
跳转到指定楼层
1
发表于 2014-7-4 19:47:48 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
或者搜索什么关键字可以找到?搜出来的都是窗户素材

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10073
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

2
发表于 2014-7-4 19:52:34 | 只看该作者
可以自己PS ,百度找教程 不难。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
139 小时
注册时间
2014-6-12
帖子
128
3
发表于 2014-7-4 20:22:47 | 只看该作者
本帖最后由 situkei 于 2014-7-4 21:45 编辑

范例和素材 Project1.rar (1.53 MB, 下载次数: 69)

做个事件就行



呼叫方法


main上面加入脚本
RUBY 代码复制
  1. module Light_Core
  2.   Effects = { #  <= DON'T change this!
  3. #-------------------------------------------------------------------------------
  4. # PUT YOUR EFFECTS HERE!
  5. #-------------------------------------------------------------------------------
  6.   0 => ["light",255,0,true],
  7.   1 => ["torch",200,20,true],
  8.   2 => ["torch_m",180,30,true],
  9.   3 => ["light_s",255,0,true],
  10.   4 => ["diannao",255,0,true],
  11.  
  12. #-------------------------------------------------------------------------------
  13. # End of effecs configuration
  14. #-------------------------------------------------------------------------------
  15.   } #  <= DON'T change this!
  16.  
  17.   # Z coordinate of the Effect's Surface
  18.   Surface_Z = 180
  19.  
  20.   # Enable Effect's Surface control by "Screen Tone" command?
  21.   Surface_UE = true
  22.  
  23.   # Roof behavior tag
  24.   Roof_Tag = 5
  25.   # Wall behavior tag
  26.   Wall_Tag = 6
  27.   # Block behavior tag
  28.   Block_Tag = 7
  29.  
  30.   # Don't change this!
  31.   ACC = Math.tan(Math::PI/26)
  32. end
  33. #-------------------------------------------------------------------------------
  34. # Script
  35. #-------------------------------------------------------------------------------
  36. module Cache
  37.   def self.light(filename)
  38.     load_bitmap("Graphics/Lights/", filename)
  39.   end
  40. end
  41. module Light_Bitcore
  42.   include Light_Core
  43.   def self.initialize
  44.     @@buffer = {}
  45.     Effects.values.each { |effect| Light_Bitcore.push(effect[0])}
  46.   end
  47.   def self::[](key)
  48.     return @@buffer[key]
  49.   end
  50.   def self.push(key)
  51.     return if @@buffer.keys.include?(key)
  52.     @@buffer[key] = Cache.light(key)
  53.   end
  54. end
  55. Light_Bitcore.initialize
  56. class Light_SSource
  57.   attr_reader :real_x
  58.   attr_reader :real_y
  59.   attr_reader :range
  60.   attr_accessor :bitmap
  61.   attr_reader :w
  62.   attr_reader :h
  63.   attr_reader :hs
  64.   def initialize(char,bitmap,opacity,plus,hs)
  65.     sync(char)
  66.     [url=home.php?mod=space&uid=20462]@KEY[/url] = bitmap
  67.     @bitmap = Light_Bitcore[@key].clone
  68.     [url=home.php?mod=space&uid=2614270]@range[/url] = @bitmap.width/2
  69.     [url=home.php?mod=space&uid=133944]@w[/url] = @bitmap.width
  70.     @h = @bitmap.height
  71.     @mr = @range - 16
  72.     @opacity = opacity
  73.     [url=home.php?mod=space&uid=304334]@plus[/url] = plus
  74.     @hs = hs
  75.     render if @hs
  76.   end
  77.   def render
  78.     tx = x
  79.     ty = y
  80.     tsx = x + @range
  81.     tsy = y + @range
  82.     dr = @range*2
  83.     for s in $game_map.surfaces
  84.       next if !s.visible?(tsx,tsy) || !s.within?(tx,tx+dr,ty,ty+dr)
  85.       s.render_shadow(tx,ty,tsx,tsy,@range,@bitmap)
  86.     end
  87.   end
  88.   def restore
  89.     return unless @bitmap.nil?
  90.     @bitmap = Light_Bitcore[@key].clone
  91.     render if @hs
  92.   end
  93.   def opacity
  94.     [url=home.php?mod=space&uid=304334]@plus[/url] == 0 ? @opacity : (@opacity + rand(@plus))
  95.   end
  96.   def sx
  97.     return $game_map.adjust_x(@real_x)*32-@mr
  98.   end
  99.   def sy
  100.     return $game_map.adjust_y(@real_y)*32-@mr
  101.   end
  102.   def sync(char)
  103.     @real_x = char.real_x
  104.     @real_y = char.real_y
  105.   end
  106.   def x
  107.     return (@real_x*32 - @mr).to_f
  108.   end
  109.   def y
  110.     return (@real_y*32 - @mr).to_f
  111.   end
  112.   def dispose
  113.     return if @bitmap.nil?
  114.     @bitmap.dispose
  115.     @bitmap = nil
  116.   end
  117. end
  118. class Light_DSource < Light_SSource
  119.   attr_reader :bitmap
  120.   attr_reader :visible
  121.   def initialize
  122.     [url=home.php?mod=space&uid=20462]@KEY[/url] = nil
  123.     @bitmap = nil
  124.     @opacity = 255
  125.     [url=home.php?mod=space&uid=304334]@plus[/url] = 0
  126.     [url=home.php?mod=space&uid=9567]@CHAR[/url] = $game_player
  127.     @visible = false
  128.   end
  129.   def set_opacity(o,p)
  130.     @opacity = o
  131.     [url=home.php?mod=space&uid=304334]@plus[/url] = p
  132.   end
  133.   def set_graphic(sb)
  134.     dispose
  135.     [url=home.php?mod=space&uid=20462]@KEY[/url] = {2=>sb,4=>sb,6=>sb,8=>sb}
  136.     Light_Bitcore.push(sb)
  137.     @bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
  138.     @range = @bitmap[2].width/2
  139.     [url=home.php?mod=space&uid=133944]@w[/url] = @bitmap[2].width
  140.     @h = @bitmap[2].height
  141.     @mr = @range - 16
  142.   end
  143.   def set_multiple_graphics(ba)
  144.     dispose
  145.     [url=home.php?mod=space&uid=20462]@KEY[/url] = ba
  146.     @key.values.each {|key| Light_Bitcore.push(key)}
  147.     @bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
  148.     @range = @bitmap[2].width/2
  149.     [url=home.php?mod=space&uid=133944]@w[/url] = @bitmap[2].width
  150.     @h = @bitmap[2].height
  151.     @mr = @range - 16
  152.   end
  153.   def get_graphic
  154.     return @bitmap[@char.direction].clone
  155.   end
  156.   def show
  157.     return if @bitmap.nil?
  158.     @visible = true
  159.   end
  160.   def hide
  161.     @visible = false
  162.   end
  163.   def restore
  164.     return if @key.nil?
  165.     @key.values.each {|key| Light_Bitcore.push(key)}
  166.     @bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
  167.   end
  168.   def dispose
  169.     return if @bitmap.nil?
  170.     @bitmap.values.each { |b| b.dispose }
  171.     @bitmap = nil
  172.   end
  173.   def change_owner(char)
  174.     @char = char
  175.   end
  176.   def render
  177.   end
  178.   def sx
  179.     return $game_map.adjust_x(@char.real_x)*32-@mr
  180.   end
  181.   def sy
  182.     return $game_map.adjust_y(@char.real_y)*32-@mr
  183.   end
  184.   def x
  185.     return (@char.real_x*32 - @mr).to_f
  186.   end
  187.   def y
  188.     return (@char.real_y*32 - @mr).to_f
  189.   end
  190. end
  191. class Light_Surface
  192.   def initialize
  193.     @ta = @a = 0
  194.     @tr = [url=home.php?mod=space&uid=186386]@r[/url] = 255
  195.     @tg = @g = 255
  196.     @tb = @b = 255
  197.     @va = @vr = @vg = @vb = 0.0
  198.     @timer = 0
  199.   end
  200.   def refresh
  201.     return if @timer == 0
  202.     @a += @va
  203.     [url=home.php?mod=space&uid=186386]@r[/url] += @vr
  204.     @g += @vg
  205.     @b += @vb
  206.     $game_map.light_surface.opacity = @a
  207.     @timer -= 1
  208.   end
  209.   def change_color(time,r,g,b,a=nil)
  210.     r = 0 if r < 0; r = 255 if r > 255
  211.     g = 0 if g < 0; g = 255 if g > 255
  212.     b = 0 if b < 0; b = 255 if b > 255
  213.     unless a.nil?
  214.       a = 0 if a < 0; a = 255 if a > 255
  215.     end
  216.     @timer = time
  217.     @tr = 255-r
  218.     @tg = 255-g
  219.     @tb = 255-b
  220.     @va = (a.nil? ? 0 : (a-@a).to_f/@timer)
  221.     @vr = (@tr - @r).to_f/@timer
  222.     @vg = (@tg - @g).to_f/@timer
  223.     @vb = (@tb - @b).to_f/@timer
  224.   end
  225.   def change_alpha(time,a)
  226.     a = 0 if a < 0; a = 255 if a > 255
  227.     @timer = time
  228.     @ta = a
  229.     @vr = @vg = @vb = 0.0
  230.     @va = (a-@a).to_f/@timer
  231.   end
  232.   def set_color(r,g,b)
  233.     r = 0 if r < 0; r = 255 if r > 255
  234.     g = 0 if g < 0; g = 255 if g > 255
  235.     b = 0 if b < 0; b = 255 if b > 255
  236.     @tr = [url=home.php?mod=space&uid=186386]@r[/url] = 255-r
  237.     @tg = @g = 255-g
  238.     @tb = @b = 255-b
  239.     @va = @vr = @vg = @vb = 0.0
  240.     @timer = 0
  241.   end
  242.   def set_alpha(a)
  243.     a = 0 if a < 0; a = 255 if a > 255
  244.     @ta = @a = a
  245.     $game_map.light_surface.opacity = @a
  246.     @va = @vr = @vg = @vb = 0.0
  247.     @timer = 0
  248.   end
  249.   def alpha
  250.     return @a
  251.   end
  252.   def color
  253.     return Color.new(@r,@g,@b)
  254.   end
  255. end
  256. class Game_Map
  257.   include Light_Core
  258.   attr_accessor :light_surface
  259.   attr_accessor :light_sources
  260.   attr_accessor :surfaces
  261.   attr_accessor :effect_surface
  262.   attr_accessor :lantern
  263.   alias kbl_setup_events setup_events
  264.   alias kbl_initialize initialize
  265.   alias kbl_update update
  266.   def initialize
  267.     kbl_initialize
  268.     @effect_surface = Light_Surface.new
  269.     @lantern = Light_DSource.new
  270.   end
  271.   def update(arg)
  272.     @effect_surface.refresh if arg
  273.     kbl_update(arg)
  274.   end
  275.   def first_tag(x,y)
  276.     tag = tileset.flags[tile_id(x,y,0)] >> 12
  277.     return tag > 0 ? tag : 0
  278.   end
  279.   def setup_events
  280.     @light_sources.nil? ? @light_sources = [] : @light_sources.clear
  281.     setup_surfaces
  282.     merge_surfaces
  283.     kbl_setup_events
  284.   end
  285.   def setup_surfaces
  286.     @surfaces = []
  287.     for x in 0..(width-1)
  288.       for y in 0..(height-1)
  289.         tag = first_tag(x,y)
  290.         if tag == Wall_Tag
  291.           i = tile_id(x,y,0)
  292.           if i & 0x02 == 0x02
  293.             @surfaces << Block_SD.new(x*32,y*32,x*32+32,y*32)
  294.           end
  295.           if i & 0x04 == 0x04
  296.             @surfaces << Block_WR.new(x*32+31,y*32,x*32+31,y*32+32)
  297.             @surfaces << Block_IL.new(x*32+32,y*32,x*32+32,y*32+32)
  298.           end
  299.           if i & 0x01 == 0x01
  300.             @surfaces << Block_IR.new(x*32-1,y*32,x*32-1,y*32+32)
  301.             @surfaces << Block_WL.new(x*32,y*32,x*32,y*32+32)
  302.           end
  303.         elsif tag == Roof_Tag
  304.           i = tile_id(x,y,0)
  305.           @surfaces << Block_SU.new(x*32,y*32,x*32+32,y*32) if i & 0x02 == 0x02
  306.           @surfaces << Block_SR.new(x*32+31,y*32,x*32+31,y*32+32) if i & 0x04 == 0x04
  307.           @surfaces << Block_SL.new(x*32,y*32,x*32,y*32+32) if i & 0x01 == 0x01
  308.         elsif tag == Block_Tag
  309.           f = tileset.flags[tile_id(x,y,0)]
  310.           @surfaces << Block_SL.new(x*32,y*32,x*32,y*32+32) if f & 0x02 == 0x02
  311.           @surfaces << Block_SR.new(x*32+31,y*32,x*32+31,y*32+32) if f & 0x04 == 0x04
  312.           @surfaces << Block_SU.new(x*32,y*32,x*32+32,y*32) if f & 0x08 == 0x08
  313.         end
  314.       end
  315.     end
  316.   end
  317.   def merge_surfaces
  318.     new_surfaces = []
  319.     hs = []; vs = []
  320.     ws = []; is = []
  321.     for surface in @surfaces
  322.       if surface.type & 0x05 == 0
  323.         hs << surface
  324.       else
  325.         if surface.type & 0x010 == 0
  326.           vs << surface
  327.         else
  328.           if surface.type & 0x08 == 0
  329.             ws << surface
  330.           else
  331.             is << surface
  332.           end
  333.         end
  334.       end
  335.     end
  336.     for surface in hs
  337.       surface.ready ? next : surface.ready = true
  338.       for s in hs
  339.         next if s.ready || s.y1 != surface.y1 || surface.type != s.type
  340.         if s.x2 == surface.x1
  341.           surface.x1 = s.x1
  342.           s.trash = true
  343.           s.ready = true
  344.           surface.ready = false
  345.         elsif s.x1 == surface.x2
  346.           surface.x2 = s.x2
  347.           s.trash = true
  348.           s.ready = true
  349.           surface.ready = false
  350.         end
  351.       end
  352.     end
  353.     hs.each { |s| @surfaces.delete(s) if s.trash}
  354.     for surface in vs
  355.       surface.ready ? next : surface.ready
  356.       for s in vs
  357.         next if s.ready || s.x1 != surface.x1
  358.         if s.y2 == surface.y1
  359.           surface.y1 = s.y1
  360.           s.trash = true
  361.           s.ready = true
  362.           surface.ready = false
  363.         elsif s.y1 == surface.y2
  364.           surface.y2 = s.y2
  365.           s.trash = true
  366.           s.ready = true
  367.           surface.ready = false
  368.         end
  369.       end
  370.     end
  371.     vs.each { |s| @surfaces.delete(s) if s.trash}
  372.     for surface in ws
  373.       surface.ready ? next : surface.ready
  374.       for s in ws
  375.         next if s.ready || s.x1 != surface.x1
  376.         if s.y2 == surface.y1
  377.           surface.y1 = s.y1
  378.           s.trash = true
  379.           s.ready = true
  380.           surface.ready = false
  381.         elsif s.y1 == surface.y2
  382.           surface.y2 = s.y2
  383.           s.trash = true
  384.           s.ready = true
  385.           surface.ready = false
  386.         end
  387.       end
  388.     end
  389.     ws.each { |s| @surfaces.delete(s) if s.trash}
  390.     for surface in is
  391.       surface.ready ? next : surface.ready
  392.       for s in is
  393.         next if s.ready || s.x1 != surface.x1
  394.         if s.y2 == surface.y1
  395.           surface.y1 = s.y1
  396.           s.trash = true
  397.           s.ready = true
  398.           surface.ready = false
  399.         elsif s.y1 == surface.y2
  400.           surface.y2 = s.y2
  401.           s.trash = true
  402.           s.ready = true
  403.           surface.ready = false
  404.         end
  405.       end
  406.     end
  407.     is.each { |s| @surfaces.delete(s) if s.trash}
  408.   end
  409. end
  410. class Game_Event < Game_Character
  411.   alias kbl_initialize initialize
  412.   alias kbl_setup_page setup_page
  413.   def initialize(m,e)
  414.     [url=home.php?mod=space&uid=22469]@light[/url] = nil
  415.     kbl_initialize(m,e)
  416.   end
  417.   def setup_page(np)
  418.     kbl_setup_page(np)
  419.     setup_light(np.nil?)
  420.   end
  421.   def setup_light(dispose)
  422.     unless @light.nil?
  423.       $game_map.light_sources.delete(self)
  424.       @light.dispose
  425.       [url=home.php?mod=space&uid=22469]@light[/url] = nil
  426.     end
  427.     unless dispose && @list.nil?
  428.       for command in @list
  429.         if command.code == 108 && command.parameters[0].include?("[light")
  430.           command.parameters[0].scan(/\[light ([0.0-9.9]+)\]/)
  431.           effect = Light_Core::Effects[$1.to_i]
  432.           [url=home.php?mod=space&uid=22469]@light[/url] = Light_SSource.new(self,effect[0],effect[1],effect[2],effect[3])
  433.           $game_map.light_sources << self
  434.           return
  435.         end
  436.       end
  437.     end
  438.   end
  439.   def draw_light
  440.     sx = @light.sx
  441.     sy = @light.sy
  442.     w = @light.w
  443.     h = @light.h
  444.     return if sx > 544 && sy > 416 && sx + w < 0 && sy + h < 0
  445.     $game_map.light_surface.bitmap.blt(sx,sy,@light.bitmap,Rect.new(0,0,w,h),@light.opacity)
  446.   end
  447.   def dispose_light
  448.     @light.dispose
  449.   end
  450.   def restore_light
  451.     @light.restore
  452.   end
  453. end
  454. if Light_Core::Surface_UE
  455.   class Game_Interpreter
  456.     def command_223
  457.       $game_map.effect_surface.change_color(@params[1],@params[0].red,@params[0].green,@params[0].blue,@params[0].gray)
  458.       wait(@params[1]) if @params[2]
  459.     end
  460.   end
  461. end
  462. class Game_Interpreter
  463.   def self_event
  464.     return $game_map.events[@event_id]
  465.   end
  466. end
  467. class Block_Surface
  468.   include Light_Core
  469.   attr_accessor :x1
  470.   attr_accessor :y1
  471.   attr_accessor :x2
  472.   attr_accessor :y2
  473.   attr_accessor :ready
  474.   attr_accessor :trash
  475.   def initialize(x1,y1,x2,y2)
  476.     @x1 = x1
  477.     @y1 = y1
  478.     @x2 = x2
  479.     @y2 = y2
  480.     @ready = false
  481.     @trash = false
  482.   end
  483.   def within?(min_x,max_x,min_y,max_y)
  484.     return @x2 > min_x && @x1 < max_x && @y2 > min_y && @y1 < max_y
  485.   end
  486. end
  487. class Block_SL < Block_Surface
  488.   attr_reader :type
  489.   def initialize(x1,y1,x2,y2)
  490.     super(x1,y1,x2,y2)
  491.     @type = 0x01
  492.   end
  493.   def visible?(sx,sy)
  494.     return sx < @x1
  495.   end
  496.   def render_shadow(phx,phy,sx,sy,range,bitmap)
  497.     @m1 = (@y1-sy)/(@x1-sx)
  498.     @n1 = sy - @m1*sx
  499.     @m2 = (@y2-sy)/(@x2-sx)
  500.     @n2 = sy - @m2*sx
  501.     for x in @x1..(sx+range)
  502.       init = shadow_iy(x)
  503.       bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+3)
  504.     end
  505.   end
  506.   def shadow_iy(x)
  507.     return @m1*x+@n1
  508.   end
  509.   def shadow_fy(x)
  510.     return @m2*x+@n2
  511.   end
  512. end
  513. class Block_SR < Block_Surface
  514.   attr_reader :type
  515.   def initialize(x1,y1,x2,y2)
  516.     super(x1,y1,x2,y2)
  517.     @type = 0x04
  518.   end
  519.   def visible?(sx,sy)
  520.     return sx > @x1
  521.   end
  522.   def render_shadow(phx,phy,sx,sy,range,bitmap)
  523.     @m1 = (@y1-sy)/(@x1-sx)
  524.     @n1 = sy - @m1*sx
  525.     @m2 = (@y2-sy)/(@x2-sx)
  526.     @n2 = sy - @m2*sx
  527.     for x in (sx-range).to_i..@x1
  528.       init = shadow_iy(x)
  529.       bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+3)
  530.     end
  531.   end
  532.   def shadow_iy(x)
  533.     return @m1*x+@n1
  534.   end
  535.   def shadow_fy(x)
  536.     return @m2*x+@n2
  537.   end
  538. end
  539. class Block_IL < Block_Surface
  540.   attr_reader :type
  541.   def initialize(x1,y1,x2,y2)
  542.     super(x1,y1,x2,y2)
  543.     @type = 0x019
  544.   end
  545.   def visible?(sx,sy)
  546.     return sx < @x1 && sy > @y1
  547.   end
  548.   def render_shadow(phx,phy,sx,sy,range,bitmap)
  549.     @m1 = (@y1-sy)/(@x1-sx)
  550.     @n1 = @y1 - @m1*@x1
  551.     @m2 = (@y2-sy)/(@x2-sx)
  552.     @m2 = 0 if @m2 > 0
  553.     @n2 = @y2 - @m2*@x2
  554.     for x in @x1..(sx+range)
  555.       init = shadow_iy(x).floor
  556.       bitmap.clear_rect(x-phx,init-3-phy,1,shadow_fy(x)-init+3)
  557.     end
  558.   end
  559.   def shadow_iy(x)
  560.     return @m1*x+@n1
  561.   end
  562.   def shadow_fy(x)
  563.     return @m2*x+@n2
  564.   end
  565. end
  566. class Block_IR < Block_Surface
  567.   attr_reader :type
  568.   def initialize(x1,y1,x2,y2)
  569.     super(x1,y1,x2,y2)
  570.     @type = 0x01c
  571.   end
  572.   def visible?(sx,sy)
  573.     return sx > @x1 && sy > @y1
  574.   end
  575.   def render_shadow(phx,phy,sx,sy,range,bitmap)
  576.     @m1 = (@y1-sy)/(@x1-sx)
  577.     @n1 = @y1 - @m1*@x1
  578.     @m2 = (@y2-sy)/(@x2-sx)
  579.     @m2 = 0 if @m2 < 0
  580.     @n2 = @y2 - @m2*@x2
  581.     for x in (sx-range).to_i..@x1
  582.       init = shadow_iy(x).floor
  583.       bitmap.clear_rect(x-phx,init-3-phy,1,shadow_fy(x)-init+3)
  584.     end
  585.   end
  586.   def shadow_iy(x)
  587.     return @m1*x+@n1
  588.   end
  589.   def shadow_fy(x)
  590.     return @m2*x+@n2
  591.   end
  592. end
  593. class Block_WL < Block_Surface
  594.   attr_reader :type
  595.   def initialize(x1,y1,x2,y2)
  596.     super(x1,y1,x2,y2)
  597.     @type = 0x011
  598.   end
  599.   def visible?(sx,sy)
  600.     return sx < @x1 && sy < @y2
  601.   end
  602.   def render_shadow(phx,phy,sx,sy,range,bitmap)
  603.     @m1 = (@y1-sy)/(@x1-sx)
  604.     @n1 = sy - @m1*sx
  605.     @m2 = (@y2-sy)/(@x2-sx)
  606.     @n2 = sy - @m2*sx
  607.     for x in @x1..(sx+range)
  608.       init = shadow_iy(x)
  609.       bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+2)
  610.     end
  611.   end
  612.   def shadow_iy(x)
  613.     return @m1*x+@n1
  614.   end
  615.   def shadow_fy(x)
  616.     return @m2*x+@n2
  617.   end
  618. end
  619. class Block_WR < Block_Surface
  620.   attr_reader :type
  621.   def initialize(x1,y1,x2,y2)
  622.     super(x1,y1,x2,y2)
  623.     @type = 0x014
  624.   end
  625.   def visible?(sx,sy)
  626.     return sx > @x1 && sy < @y2
  627.   end
  628.   def render_shadow(phx,phy,sx,sy,range,bitmap)
  629.     @m1 = (@y1-sy)/(@x1-sx)
  630.     @n1 = sy - @m1*sx
  631.     @m2 = (@y2-sy)/(@x2-sx)
  632.     @n2 = sy - @m2*sx
  633.     for x in (sx-range).to_i..@x1
  634.       init = shadow_iy(x)
  635.       bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+2)
  636.     end
  637.   end
  638.   def shadow_iy(x)
  639.     return @m1*x+@n1
  640.   end
  641.   def shadow_fy(x)
  642.     return @m2*x+@n2
  643.   end
  644. end
  645. class Block_SU < Block_Surface
  646.   attr_reader :type
  647.   def initialize(x1,y1,x2,y2)
  648.     super(x1,y1,x2,y2)
  649.     @type = 0x02
  650.   end
  651.   def visible?(sx,sy)
  652.     return sy < @y1
  653.   end
  654.   def render_shadow(phx,phy,sx,sy,range,bitmap)
  655.     if @x1 == sx
  656.       @m1 = nil
  657.     else
  658.       @m1 = (@y1-sy)/(@x1-sx)
  659.       @m1 += ACC if @m1 < -ACC
  660.       @n1 = @y1 - @m1*@x1
  661.     end
  662.     if @x2 == sx
  663.       @m2 = nil
  664.     else
  665.       @m2 = (@y2-sy)/(@x2-sx)
  666.       @n2 = sy - @m2*sx
  667.     end
  668.     for y in @y1..(sy+range)
  669.       init = shadow_ix(y)
  670.       bitmap.clear_rect(init-phx,y-phy,shadow_fx(y)-init+1,1)
  671.     end
  672.   end
  673.   def shadow_ix(y)
  674.     return @m1.nil? ? @x1 : (y-@n1)/@m1
  675.   end
  676.   def shadow_fx(y)
  677.     return @m2.nil? ? @x2 : (y-@n2)/@m2
  678.   end
  679. end
  680. class Block_SD < Block_Surface
  681.   attr_reader :type
  682.   def initialize(x1,y1,x2,y2)
  683.     super(x1,y1,x2,y2)
  684.     @type = 0x08
  685.   end
  686.   def visible?(sx,sy)
  687.     return sy > @y1
  688.   end
  689.   def render_shadow(phx,phy,sx,sy,range,bitmap)
  690.     if @x1 == sx
  691.       @m1 = nil
  692.     else
  693.       @m1 = (@y1-sy)/(@x1-sx)
  694.       @m1 -= ACC if @m1 > ACC
  695.       @n1 = sy - @m1*sx
  696.     end
  697.     if x2 == sx
  698.       @m2 = nil
  699.     else
  700.       @m2 = (@y2-sy)/(@x2-sx)
  701.       @n2 = sy - @m2*sx
  702.     end
  703.     for y in (sy-range).to_i..@y1
  704.       init = shadow_ix(y)
  705.       bitmap.clear_rect(init-phx,y-phy,shadow_fx(y)-init+1,1)
  706.     end
  707.   end
  708.   def shadow_ix(y)
  709.     return @m1.nil? ? @x1 : (y-@n1)/@m1
  710.   end
  711.   def shadow_fx(y)
  712.     return @m2.nil? ? @x2 : (y-@n2)/@m2
  713.   end
  714. end
  715. class Spriteset_Map
  716.   include Light_Core
  717.   alias kbl_initialize initialize
  718.   alias kbl_update update
  719.   alias kbl_dispose dispose
  720.   def initialize
  721.     setup_lights
  722.     kbl_initialize
  723.   end
  724.   def update
  725.     kbl_update
  726.     update_lights
  727.   end
  728.   def dispose
  729.     kbl_dispose
  730.     dispose_lights
  731.   end
  732.   def dispose_lights
  733.     $game_map.lantern.dispose
  734.     $game_map.light_sources.each { |source| source.dispose_light }
  735.     $game_map.light_surface.bitmap.dispose
  736.     $game_map.light_surface.dispose
  737.     $game_map.light_surface = nil
  738.   end
  739.   def update_lights
  740.     $game_map.light_surface.bitmap.clear
  741.     $game_map.light_surface.bitmap.fill_rect(0,0,800,600,$game_map.effect_surface.color)
  742.     $game_map.light_sources.each { |source| source.draw_light }
  743.     return unless $game_map.lantern.visible
  744.     @btr = $game_map.lantern.get_graphic
  745.     x = $game_map.lantern.x
  746.     y = $game_map.lantern.y
  747.     r = $game_map.lantern.range
  748.     sx = x + r
  749.     sy = y + r
  750.     dr = r*2
  751.     $game_map.surfaces.each { |s| s.render_shadow(x,y,sx,sy,r,@btr) if s.visible?(sx,sy) && s.within?(x,x+dr,y,y+dr) }
  752.     $game_map.light_surface.bitmap.blt($game_map.lantern.sx,$game_map.lantern.sy,@btr,Rect.new(0,0,dr,dr),$game_map.lantern.opacity)
  753.   end
  754.   def setup_lights
  755.     @btr = nil
  756.     $game_map.lantern.restore
  757.     $game_map.light_sources.each { |source| source.restore_light }
  758.     $game_map.light_surface = Sprite.new
  759.     $game_map.light_surface.bitmap = Bitmap.new(800,600)
  760.     $game_map.light_surface.bitmap.fill_rect(0,0,544,416,$game_map.effect_surface.color)
  761.     $game_map.light_surface.blend_type = 2
  762.     $game_map.light_surface.opacity = $game_map.effect_surface.alpha
  763.     $game_map.light_surface.z = Surface_Z
  764.   end
  765. end
   

新建 BMP 图像 (4).JPG (35.5 KB, 下载次数: 17)

新建 BMP 图像 (4).JPG

点评

那你也得把素材一起放上来吧。。。  发表于 2014-7-4 20:37
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
139 小时
注册时间
2014-6-12
帖子
128
4
发表于 2014-7-4 21:32:17 | 只看该作者
VIPArcher 发表于 2014-7-4 19:52
可以自己PS ,百度找教程 不难。

已经加上范例了

点评

不用特地告诉我,而且你这个似乎没法符合楼主的要求。  发表于 2014-7-4 21:35
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-24 01:16

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表