赞 | 0 |
VIP | 0 |
好人卡 | 1 |
积分 | 1 |
经验 | 11469 |
最后登录 | 2017-9-6 |
在线时间 | 426 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 426 小时
- 注册时间
- 2011-2-25
- 帖子
- 126
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
切换场景后移动 事件、角色就会出现分身,如果原地等待3秒再走又正常,麻烦大佬们给看看
- #Particle_Sprite.new(@ground1,false)
- #==============================================================================
- # ■ Spriteset_Map
- #------------------------------------------------------------------------------
- # 处理地图画面活动块和元件的类。本类在 Scene_Map 类的内部使用。
- #==============================================================================
- $事件 = []
- class Spriteset_Map
- #--------------------------------------------------------------------------
- # ● 生成角色活动块
- #--------------------------------------------------------------------------
- alias qqeat_create_characters create_characters
- def create_characters
- qqeat_create_characters
- @character_sprites = []
- $事件 = []
- for i in $game_map.events.keys.sort
- sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
- @character_sprites.push(sprite)
- $事件[i] = sprite
- end
- for vehicle in $game_map.vehicles
- sprite = Sprite_Character.new(@viewport1, vehicle)
- @character_sprites.push(sprite)
- end
- sprite = Sprite_Character.new(@viewport1, $game_player)
- @character_sprites.push(sprite)
- $事件[0] = sprite
- end
- end
- class Particle
- #人物
- def self.character(character_id, wait = true)
-
- character = $game_map.events[character_id]
- sprite = $事件[character_id]
-
- @spr1 = Sprite.new
- @spr1.x = sprite.x - sprite.ox
- @spr1.y = sprite.y - sprite.oy
-
- sign = character.character_name[/^[\!\$]./]
- if sign != nil and sign.include?(')
- cw = sprite.bitmap.width / 3
- ch = sprite.bitmap.height / 4
- else
- cw = sprite.bitmap.width / 12
- ch = sprite.bitmap.height / 8
- end
- sx = (character.character_index % 4 * 3 + (character.pattern < 3 ? character.pattern : 1)) * cw
- sy = (character.character_index / 4 * 4 + (character.direction - 2) / 2) * ch
-
- @spr1.bitmap = Bitmap.new(cw,ch)
- @spr1.bitmap.blt(0,0,sprite.bitmap,Rect.new(sx,sy,cw,ch))
-
- Dis_Bitmap.new(@spr1.x,@spr1.y,@spr1.bitmap,0,0,@spr1.bitmap.width,@spr1.bitmap.height,300,5,0.5)
- return if !wait
- $事件[character.id].visible = false
- 0.times{|i|@spr1.opacity -= 8;Graphics.update}
- @spr1.dispose
- end
- end
- class Dis_Bitmap
- #————————————————————————————————————————
- #*New Dis_Bitmap
- #————————————————————————————————————————
- def initialize(sx,sy,m_bitmap,x,y,w,h,n,d=4,co=0.5,type=:RU,rc=true,
- clear=true,viewport=nil,&set_spr_proc)
- @spr_datas = []; @viewport = viewport;jn = n;oo = 200
- case n
- when -1
- n = w * h / d ** 2 / 2;lw = w / d;lh = h / d
- sxy = Proc.new{|i|@xo = x + sx + i % lw * d ; @yo = y + sy + i % lh * d }
- when 0
- n = w * h / d ** 2;lw = w / d;lh = n / (h / d)
- sxy = Proc.new{|i|@xo = x + sx + i % lw * d ; @yo = y + sy + i / lh * d }
- else
- sxy = Proc.new{ @xo = x + sx + rand(w);@yo = y + sy + rand(h) }
- end
- n.times{|i|sxy.call(i)
- rx = rand(100) / 100.0
- ry = rand(100) / 100.0
- ro = co + rand(550) / 100.0
- @spr_datas[i] = [Sprite.new(viewport),@xo,@yo,oo,rx,ry,ro]
- spr = @spr_datas[i][0]
- spr.x = @xo;spr.y = @yo;spr.z = 5000
- spr.bitmap = Bitmap.new(d,d)
- rc ? m_bitmap.rc(@xo-sx,@yo-sy,d,0,true,1.0,spr.bitmap,clear) :
- m_bitmap.rf(@xo-sx,@yo-sy,d,d,spr.bitmap,clear)
- set_spr_proc.call(spr) if set_spr_proc }
- m_bitmap.clear_rect(x,y,w,h) if clear && jn < 1
- case type
- when :RU
- @proc = Proc.new {|spr_data|
- spr_data[1] += spr_data[4]
- spr_data[2] -= spr_data[5]
- spr_data[3] -= spr_data[6] }
- when :LU
- @proc = Proc.new {|spr_data|
- spr_data[1] -= spr_data[4]
- spr_data[2] -= spr_data[5]
- spr_data[3] -= spr_data[6] }
- when :RD
- @proc = Proc.new {|spr_data|
- spr_data[1] += spr_data[4]
- spr_data[2] += spr_data[5]
- spr_data[3] -= spr_data[6] }
- when :LD
- @proc = Proc.new {|spr_data|
- spr_data[1] -= spr_data[4]
- spr_data[2] += spr_data[5]
- spr_data[3] -= spr_data[6] }
- end
- self.begin
- end
- #————————————————————————————————————————
- #*All sprite
- #————————————————————————————————————————
- def get_all_spr
- @spr_datas.collect {|spr_data|spr_data[0]}
- end
- #————————————————————————————————————————
- #*Viewport
- #————————————————————————————————————————
- def get_viewport
- @viewport
- end
- #————————————————————————————————————————
- #*Control
- #————————————————————————————————————————
- def stop
- Graphics.dis_bitmap_all.delete(self)
- end
- def begin
- return if Graphics.dis_bitmap_all.include?(self)
- Graphics.dis_bitmap_all << self
- end
- #————————————————————————————————————————
- #*Update
- #————————————————————————————————————————
- def update
- @spr_datas.each_with_index {|spr_data,index|
- spr = spr_data[0]
- @proc.call(spr_data)
- spr.x = spr_data[1]
- spr.y = spr_data[2]
- spr.opacity = spr_data[3]
- if spr_data[3] <= 0
- spr.dispose
- spr.bitmap.dispose
- @spr_datas.delete_at(index)
- stop if @spr_datas.empty?
- end }
- end
- #————————————————————————————————————————
- #*Dispose
- #————————————————————————————————————————
- def dispose
- @spr_datas.each {|spr_data|
- spr = spr_data[0]
- spr.dispose
- spr.bitmap.dispose }
- @viewport.dispose if @viewport
- end
- end
- #————————————————————————————————————————
- #*Graphics
- #————————————————————————————————————————
- module Graphics
- @dis_bitmap_all = []
- class << self
- #————————————————————————————————————————
- #*Alias
- #————————————————————————————————————————
- alias_method(:acc_update,:update) unless method_defined?(:acc_update)
- alias_method(:acc_freeze,:freeze) unless method_defined?(:acc_freeze)
- def update
- acc_update;@dis_bitmap_all.each {|dis_bitmap|dis_bitmap.update}
- end
- def freeze
- @dis_bitmap_all.each{|dis_bitmap|dis_bitmap.dispose}
- @dis_bitmap_all = [];acc_freeze
- end
- #————————————————————————————————————————
- #*All Dis_Bitmap instance
- #————————————————————————————————————————
- def dis_bitmap_all
- @dis_bitmap_all
- end
- end
- end
- class Bitmap
- #————————————————————————————————————————
- #*Def clear_rect
- #————————————————————————————————————————
- unless method_defined?(:clear_rect)
- OC0 = Color.new(0,0,0,0)
- def clear_rect(x,y,width,height)
- fill_rect(x, y, width, height, OC0)
- end
- end
- #————————————————————————————————————————
- #*RC bitmap
- #————————————————————————————————————————
- def rc(x,y,d,e=0,f=true,l=1.0,bitmap=self,rc_clear=true)
- t = nil;d2 = d*2;d3 = d/2
- d2.times {|i| xo = (Math.sin(Math::PI/d2*i)*(d3+e)).round
- yo = (Math.cos(Math::PI/d2*i)*(d3)).round;t == yo ? next : t = yo;c = xo*2*l
- f ? (xb,yb,w,h = x+xo-c+d3,y+yo+d3,c,1) : (xb,yb,w,h = y+yo+d3,x+xo-c+d3,1,c)
- bitmap.blt(xb-x,yb-y,self,Rect.new(xb,yb,w,h))
- clear_rect(xb,yb,w,h) if rc_clear }
- end
- def rf(x,y,w,h,bitmap=self,rc_clear=true)
- bitmap.blt(0,0,self,Rect.new(x,y,w,h))
- clear_rect(x,y,w,h) if rc_clear
- end
- end
复制代码 |
|