赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 18684 |
最后登录 | 2020-5-5 |
在线时间 | 9 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 60
- 在线时间
- 9 小时
- 注册时间
- 2006-9-7
- 帖子
- 303
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
名字挡住了人物,怎么修改,让名字不会挡住了人物.
使用的脚本:
- #-------------------------------------------------------------------------------
- class Game_Event < Game_Character
- def name
- return @event.name
- end
- def name=(newname)
- @event.name = newname
- end
- end
- class Game_Player < Game_Character
- def name
- return $game_party.actors[0].name
- end
- end
- class Sprite_Character < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :character
- def initialize(viewport, character = nil)
- name = character.name
- super(viewport)
- @character = character
- @namesprite = Sprite.new
- @namesprite.bitmap = Bitmap.new(160, 45)
- @namesprite.bitmap.font.name = "宋体"
- @namesprite.bitmap.font.size = 16
- @namesprite.bitmap.font.color.set(0, 255, 0)
- @evname = name
- @evname_split = name.split(/,/)[0]
- if name[0, 2]=="EV"
- @evname_split = " "
- end
- if name.split(/,/)[1] != nil
- case name.split(/,/)[1]
- when "0"
- @namesprite.bitmap.font.color.set(255, 255, 255)
- when "1"
- @namesprite.bitmap.font.color.set(128, 128, 255)
- when "2"
- @namesprite.bitmap.font.color.set(255, 128, 128)
- when "3"
- @namesprite.bitmap.font.color.set(128, 255, 128)
- when "4"
- @namesprite.bitmap.font.color.set(128, 255, 255)
- when "5"
- @namesprite.bitmap.font.color.set(255, 128, 255)
- when "6"
- @namesprite.bitmap.font.color.set(255, 255, 128)
- when "7"
- @namesprite.bitmap.font.color.set(192, 192, 192)
- else
- @namesprite.bitmap.font.color.set(0, 255, 0)
- end
- end
- if @evname_split != "" and @evname_split != nil
- @namesprite.bitmap.draw_text(0, 0, 160, 36, @evname_split, 1)
- end
- update
- end
- end
- class Sprite_Character < RPG::Sprite
- def update
- super
- if @evname != @character.name
- @namesprite.bitmap.clear
- @evname = @character.name
- @evname_split = @character.name.split(/,/)[0]
- if @character.name.split(/,/)[1] != nil
- case @character.name.split(/,/)[1]
- when "0"
- @namesprite.bitmap.font.color.set(255, 255, 255)
- when "1"
- @namesprite.bitmap.font.color.set(128, 128, 255)
- when "2"
- @namesprite.bitmap.font.color.set(255, 128, 128)
- when "3"
- @namesprite.bitmap.font.color.set(128, 255, 128)
- when "4"
- @namesprite.bitmap.font.color.set(128, 255, 255)
- when "5"
- @namesprite.bitmap.font.color.set(255, 128, 255)
- when "6"
- @namesprite.bitmap.font.color.set(255, 255, 128)
- when "7"
- @namesprite.bitmap.font.color.set(192, 192, 192)
- else
- @namesprite.bitmap.font.color.set(0, 255, 0)
- end
- end
- @namesprite.bitmap.draw_text(0, 0, 160, 36, @evname_split, 1)
- end
- @namesprite.x = self.x-80
- @namesprite.y = self.y-self.oy + 160
- # 元件 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)
- @cw = bitmap.width / $c3_每一步的帧数
- if $c3_总共可用的方向数==4
- @ch = bitmap.height / 4
- else
- @ch = bitmap.height / 8
- end
- self.ox = @cw / 2
- self.oy = @ch
- end
- end
- # 设置可视状态
- self.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)
- end
- # 设置脚本的坐标
- self.x = @character.screen_x
- self.y = @character.screen_y
- self.z = @character.screen_z(@ch)
- # 设置不透明度、合成方式、茂密
- 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
复制代码
|
|