| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2013-11-13 |
| 在线时间 | 79 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 79 小时
- 注册时间
- 2007-6-23
- 回帖
- 147
|
发表于 2013-8-21 12:10:06
|
显示全部楼层
本帖最后由 fangyc 于 2013-8-21 12:18 编辑
我估计把Sprite_Base的194和195行删去,插入下面几行,估计可行- sw = sprite.bitmap.width / 5
- sx = (sw - 192) / 2
- sprite.src_rect.set(pattern % 5 * sw + sx,
- pattern % 100 / 5 * sw + sx, 192, 192)
复制代码 但你仍需把512x512的素材拼成5行20列的才行。使用默认素材也没问题。
以防万一,贴上完整方法
[pre lang="ruby" line="1"] #--------------------------------------------------------------------------
# ● 设置动画的精灵
# frame : 帧数据(RPG::Animation::Frame)
#--------------------------------------------------------------------------
def animation_set_sprites(frame)
cell_data = frame.cell_data
@ani_sprites.each_with_index do |sprite, i|
next unless sprite
pattern = cell_data[i, 0]
if !pattern || pattern < 0
sprite.visible = false
next
end
sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
sprite.visible = true
sw = sprite.bitmap.width / 5
sx = (sw - 192) / 2
sprite.src_rect.set(pattern % 5 * sw + sx,
pattern % 100 / 5 * sw + sx, 192, 192)
if @ani_mirror
sprite.x = @ani_ox - cell_data[i, 1]
sprite.y = @ani_oy + cell_data[i, 2]
sprite.angle = (360 - cell_data[i, 4])
sprite.mirror = (cell_data[i, 5] == 0)
else
sprite.x = @ani_ox + cell_data[i, 1]
sprite.y = @ani_oy + cell_data[i, 2]
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
end
sprite.z = self.z + 300 + i
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end[/pre] |
评分
-
查看全部评分
|