赞 | 0 |
VIP | 13 |
好人卡 | 65 |
积分 | 1 |
经验 | 58644 |
最后登录 | 2017-10-23 |
在线时间 | 1281 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 1281 小时
- 注册时间
- 2006-8-27
- 帖子
- 590
|
- # 文件名第一位'%'支持4张循环
- class Sprite_Character < Sprite_Base
- #--------------------------------------------------------------------------
- # ● 设定角色的位图
- #--------------------------------------------------------------------------
- def set_character_bitmap
- self.bitmap = Cache.character(@character_name)
- sign = @character_name[/^[\!\$]./]
- if @character_name[0] == '%'
- @cw = bitmap.width / 4
- @ch = bitmap.height / 4
- elsif sign && sign.include?('$')
- @cw = bitmap.width / 3
- @ch = bitmap.height / 4
- else
- @cw = bitmap.width / 12
- @ch = bitmap.height / 8
- end
- self.ox = @cw / 2
- self.oy = @ch
- end
- #--------------------------------------------------------------------------
- # ● 源矩形的更新
- #--------------------------------------------------------------------------
- def update_src_rect
- if @tile_id == 0
- if @character_name[0] == '%'
- sx = ((@character.pattern+1) % 4) * @cw
- sy = (@character.direction - 2) / 2 * @ch
- else
- index = @character.character_index
- pattern = @character.pattern < 3 ? @character.pattern : 1
- sx = (index % 4 * 3 + pattern) * @cw
- sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
- end
- self.src_rect.set(sx, sy, @cw, @ch)
- end
- end
- end
复制代码 |
|