赞 | 663 |
VIP | 62 |
好人卡 | 144 |
积分 | 334 |
经验 | 110435 |
最后登录 | 2024-11-1 |
在线时间 | 5108 小时 |
Lv5.捕梦者
- 梦石
- 0
- 星屑
- 33418
- 在线时间
- 5108 小时
- 注册时间
- 2012-11-19
- 帖子
- 4878
|
这个
- #==============================================================================
- class Sprite_Character < RPG::Sprite
- #--------------------------------------------------------------------------
- # 有气泡显示的地图ID
- PLAY_MAP_ID = [1,2]
- # 不显示气泡的行走图名
- NON_PLAY_CHARACTER = ["",""]
- # 控制显示的开关ID
- SMALL_SWITCHE = 10
- # 气泡样式转换样式的间隔帧数
- PATTERN_TIME = 10
- # 无气泡的空隙时间帧数
- WAIT_TIME = 20
- # 气泡相对于人物坐标的X轴调整
- ADD_X = 0
- # 气泡相对于人物坐标的Y轴调整
- ADD_Y = 0
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- alias xr_addsmall_initialize initialize
- def initialize(viewport, character = nil)
- @small_dor = Sprite.new(viewport)
- @count = 0; @max_count = PATTERN_TIME * 16 + WAIT_TIME
- xr_addsmall_initialize(viewport, character)
- end
- #--------------------------------------------------------------------------
- def dispose
- @small_dor.bitmap.dispose if @small_dor.bitmap
- @small_dor.dispose
- super
- end
- #--------------------------------------------------------------------------
- alias xr_addsmall_update update
- def update
- @count = (@count + 1) % @max_count
- create_small if need_refresh
- update_visible if @data_visible != self.visible
- update_pattern if @small_dor.bitmap
- xr_addsmall_update
- end
- #--------------------------------------------------------------------------
- def create_small
- @data_name = @character.character_name
- @data_switch = $game_switches[SMALL_SWITCHE]
- @data_sname = $game_system.small_name
- @small_dor.bitmap.dispose if @small_dor.bitmap
- return unless small_show?
- @small_dor.bitmap = RPG::Cache.character(@data_sname, 0)
- @sw = @small_dor.bitmap.width / 4;@sh = @small_dor.bitmap.height / 4
- @small_dor.ox = @sw / 2;@small_dor.oy = @sh
- end
- #--------------------------------------------------------------------------
- def update_visible
- @small_dor.visible = @data_visible = self.visible
- end
- #--------------------------------------------------------------------------
- def update_pattern
- sx = @count / PATTERN_TIME % 4 * @sw
- sy = @count / PATTERN_TIME / 4 * @sh
- @small_dor.src_rect.set(sx, sy, @sw, @sh)
- @small_dor.x = @character.screen_x + ADD_X
- @small_dor.y = @character.screen_y + ADD_Y
- @small_dor.z = self.z + 16
- end
- #--------------------------------------------------------------------------
- def need_refresh
- return false unless @character
- return true if @data_name != @character.character_name
- return true if @data_switch != $game_switches[SMALL_SWITCHE]
- return true if @data_sname != $game_system.small_name
- return false
- end
- #--------------------------------------------------------------------------
- def small_show?
- return false unless PLAY_MAP_ID.include?($game_map.map_id)
- return false unless @character
- return false unless $game_switches[SMALL_SWITCHE]
- return false if @character.tile_id > 0 or @character.character_name == ""
- return false if NON_PLAY_CHARACTER.include?(@character.character_name)
- return true
- end
- end
- #==============================================================================
- class Game_System
- def small_name; return @small_name || "气泡"; end
- def set_small_name(name);@small_name = name; end
- end
- #==============================================================================
复制代码 |
|