赞 | 45 |
VIP | 0 |
好人卡 | 2 |
积分 | 136 |
经验 | 67210 |
最后登录 | 2024-11-14 |
在线时间 | 3851 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 13635
- 在线时间
- 3851 小时
- 注册时间
- 2013-7-18
- 帖子
- 2313
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- #==============================================================================
- # ■ Sprite_Character
- #------------------------------------------------------------------------------
- # 角色显示用脚本。监视 Game_Character 类的实例、
- # 自动变化脚本状态。
- #==============================================================================
- class Sprite_Character < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :character # 角色
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # viewport : 查看端口
- # character : 角色 (Game_Character)
- #--------------------------------------------------------------------------
- def initialize(viewport, character = nil)
- super(viewport)
- [url=home.php?mod=space&uid=2631396]@character[/url] = character
- [url=home.php?mod=space&uid=31758]@Shadow[/url] = RPG::Sprite.new(viewport)
- update
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 元件 ID、文件名、色相与现在的情况存在差异的情况下
- if @tile_id != @character.tile_id or
- @character_name != @character.character_name or
- @character_hue != @character.character_hue
- # 记忆元件 ID 与文件名、色相
- @tile_id = @character.tile_id
- @character_name = @character.character_name
- @character_hue = @character.character_hue
- # 元件 ID 为有效值的情况下
- 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
- # 元件 ID 为无效值的情况下
- else
- self.bitmap = RPG::Cache.character(@character.character_name,
- @character.character_hue)
- @shadow.bitmap = RPG::Cache.character(@character.character_name,
- @character.character_hue)
- @shadow.flash(Color.new(0, 0, 0, 255), 1)
- @shadow.angle = 180
- @shadow.mirror = true
- @cw = bitmap.width / 4
- @ch = bitmap.height / 4
- self.ox = @cw / 2
- self.oy = @ch
- @shadow.ox = @cw / 2
- @shadow.oy = @ch / 2
- end
- end
- # 设置可视状态
- self.visible = (not @character.transparent)
- @shadow.visible = (not @character.transparent)
- # 图形是角色的情况下
- if @tile_id == 0
- # 设置传送目标的矩形
- sx = @character.pattern * @cw
- if $c3_总共可用的方向数 == 8
- case @character.direction
- when 2
- sy = 0 * @ch
- when 4
- sy = 1 * @ch
- when 6
- sy = 2 * @ch
- when 8
- sy = 3 * @ch
- when 1
- sy = 4 * @ch
- when 3
- sy = 5 * @ch
- when 7
- sy = 6 * @ch
- when 9
- sy = 7 * @ch
- end
- else
- sy = (@character.direction - 2) / 2 * @ch
- end
- self.src_rect.set(sx, sy, @cw, @ch)
- @shadow.src_rect.set(sx, sy, @cw, @ch)
- end
- # 设置脚本的坐标
- self.x = @character.screen_x
- self.y = @character.screen_y
- self.z = @character.screen_z(@ch)
- @shadow.x = @character.screen_x
- @shadow.y = @character.screen_y - 7
- @shadow.z = 0
- @shadow.zoom_y = 0.5
- @shadow.zoom_x = 1
- # 设置不透明度、合成方式、茂密
- self.opacity = @character.opacity
- @shadow.opacity = @character.opacity * 0.6
- 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
复制代码
能否给这个角色影子脚本加个开关
|
|