赞 | 0 |
VIP | 133 |
好人卡 | 5 |
积分 | 1 |
经验 | 15036 |
最后登录 | 2017-9-12 |
在线时间 | 190 小时 |
Lv1.梦旅人 彩色的银子
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 190 小时
- 注册时间
- 2006-6-13
- 帖子
- 1361
|
-_________-一时激动。。。望见谅。- 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 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 -= 5
- self.blend_type = 1
- 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)
复制代码 |
|