赞 | 77 |
VIP | 0 |
好人卡 | 0 |
积分 | 146 |
经验 | 0 |
最后登录 | 2024-10-24 |
在线时间 | 2147 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 14565
- 在线时间
- 2147 小时
- 注册时间
- 2016-9-20
- 帖子
- 859
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
#幻影by 66rpg 神思 不知为什么在原点(大慨要在scene_map下 #__END__ class Game_Player < Game_Character def mirage(opacity) $scene.spriteset.mirage(self, opacity) end alias update_naiyoudadangao update def update update_naiyoudadangao if Input.dir8 != 0 mirage(120) end end end class Game_Event < Game_Character def mirage(opacity) $scene.spriteset.mirage(self, opacity) end end class Sprite_MirageCharacter < RPG::Sprite attr_accessor :character def initialize(viewport, opacity, character = nil) super(viewport) @character = character self.opacity = opacity update end def update super if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue @tile_id = @character.tile_id @character_name = @character.character_name @character_hue = @character.character_hue if @tile_id >= 384 self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue) self.src_rect.set(0, 0, 32, 32) self.ox = 16 self.oy = 32 else self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) @cw = bitmap.width / 4 @ch = bitmap.height / 4 self.ox = @cw / 2 self.oy = @ch self.x = @character.screen_x self.y = @character.screen_y end end self.visible = (not @character.transparent) if @tile_id == 0 and !@t sx = @character.pattern * @cw sy = (@character.direction - 2) / 2 * @ch self.src_rect.set(sx, sy, @cw, @ch) @t = true end self.z = @character.screen_z(@ch) self.color.set(0,0,170,120) self.opacity -= 8 #b残像减少(大就没有)小效果多 self.blend_type = 0 self.bush_depth = @character.bush_depth if @character.animation_id != 0 animation = $data_animations[@character.animation_id] animation(animation, true) @character.animation_id = 0 end end end class Spriteset_Map alias initialize_naiyoudadangao initialize def initialize @mirage = {} initialize_naiyoudadangao end def mirage(obj, opacity) @mirage[obj] ||= [] smc = Sprite_MirageCharacter.new(@viewport1, opacity, obj) @mirage[obj] << Mirage.new(obj.real_x, obj.real_y, smc)#(Sprite_MirageCharacter.new(@viewport1, opacity, obj)) end alias update_naiyoudadangao update def update update_naiyoudadangao for value in @mirage.values for v in value v.smc.x = (v.x - $game_map.display_x + 3) / 4 + 16 v.smc.y = (v.y - $game_map.display_y + 3) / 4 + 32 v.smc.update if v.smc.opacity <= 0 v.smc.dispose value.delete(v) end end end end end class Scene_Map attr_reader :spriteset end Mirage = Struct.new(:x, :y, :smc)
#幻影by 66rpg 神思 不知为什么在原点(大慨要在scene_map下
#__END__
class Game_Player < Game_Character
def mirage(opacity)
$scene.spriteset.mirage(self, opacity)
end
alias update_naiyoudadangao update
def update
update_naiyoudadangao
if Input.dir8 != 0
mirage(120)
end
end
end
class Game_Event < Game_Character
def mirage(opacity)
$scene.spriteset.mirage(self, opacity)
end
end
class Sprite_MirageCharacter < RPG::Sprite
attr_accessor :character
def initialize(viewport, opacity, character = nil)
super(viewport)
@character = character
self.opacity = opacity
update
end
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
self.x = @character.screen_x
self.y = @character.screen_y
end
end
self.visible = (not @character.transparent)
if @tile_id == 0 and !@t
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
@t = true
end
self.z = @character.screen_z(@ch)
self.color.set(0,0,170,120)
self.opacity -= 8 #b残像减少(大就没有)小效果多
self.blend_type = 0
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end
class Spriteset_Map
alias initialize_naiyoudadangao initialize
def initialize
@mirage = {}
initialize_naiyoudadangao
end
def mirage(obj, opacity)
@mirage[obj] ||= []
smc = Sprite_MirageCharacter.new(@viewport1, opacity, obj)
@mirage[obj] << Mirage.new(obj.real_x, obj.real_y, smc)#(Sprite_MirageCharacter.new(@viewport1, opacity, obj))
end
alias update_naiyoudadangao update
def update
update_naiyoudadangao
for value in @mirage.values
for v in value
v.smc.x = (v.x - $game_map.display_x + 3) / 4 + 16
v.smc.y = (v.y - $game_map.display_y + 3) / 4 + 32
v.smc.update
if v.smc.opacity <= 0
v.smc.dispose
value.delete(v)
end
end
end
end
end
class Scene_Map
attr_reader :spriteset
end
Mirage = Struct.new(:x, :y, :smc)
class Game_Event < Game_Character
def mirage(opacity)
$scene.spriteset.mirage(self, opacity)
end
end
这个是我加的貌似加了也没效 |
|