Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # [Xp] Icon & Battler Graphic in Event
- # Version: 1.01
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #==============================================================================
- # ** Game_Character
- #------------------------------------------------------------------------------
- # This class deals with events. It handles functions including event page
- # switching via condition determinants, and running parallel process events.
- # It's used within the Game_Map class.
- #==============================================================================
- class Game_Character
- attr_accessor :graphic_ex
- def icon_graphic(val) @character_name,@graphic_ex = '(Icon)', val end
- def battler_graphic(val) @character_name,@graphic_ex = '(Battler)', val end
- end
- #==============================================================================
- # ** Sprite_Character
- #------------------------------------------------------------------------------
- # This sprite is used to display the character.It observes the Game_Character
- # class and automatically changes sprite conditions.
- #==============================================================================
- class Sprite_Character < RPG::Sprite
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- alias update_for_item_icon update
- def update
- super
- if @character.character_name == '(Icon)' or
- @character.character_name == '(Battler)'
- 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
- @icon_name = @character.graphic_ex
- bit = @icon_name.nil? ? '' : @icon_name
- if @character_name == '(Icon)'
- self.bitmap = RPG::Cache.icon(bit)
- self.src_rect.set(0, 0, 24, 24)
- self.ox = 12
- self.oy = 24
- elsif @character_name == '(Battler)'
- self.bitmap = RPG::Cache.battler(bit, @character_hue)
- @width = bitmap.width
- @height = bitmap.height
- self.ox = @width / 2
- self.oy = @height
- end
- end
- update_for_icon_sprite
- else
- update_for_item_icon
- end
- end
- #--------------------------------------------------------------------------
- # ● Create Icon Sprite
- #--------------------------------------------------------------------------
- def update_for_icon_sprite
- self.visible = (not @character.transparent)
- self.x = @character.screen_x
- self.y = @character.screen_y
- self.z = @character.screen_z(24)
- self.opacity = @character.opacity
- self.blend_type = @character.blend_type
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement