加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
搜到一个让图块元件遮挡动画的方法(脚本如下),但是我还用了一个多动画显示的脚本,这个脚本使得元件遮挡动画无效了,求并存的解决方法!
请看工程:
遮挡动画.rar
(189.14 KB, 下载次数: 96)
module RPG class Sprite < ::Sprite def animation_set_sprites(sprites, cell_data, position) for i in 0..15 sprite = sprites[ i ] pattern = cell_data[i, 0] if sprite == nil or pattern == nil or pattern == -1 sprite.visible = false if sprite != nil next end sprite.visible = true sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192) if position == 3 if self.viewport != nil sprite.x = self.viewport.rect.width / 2 sprite.y = self.viewport.rect.height - 160 else sprite.x = 320 sprite.y = 240 end else sprite.x = self.x - self.ox + self.src_rect.width / 2 sprite.y = self.y - self.oy + self.src_rect.height / 2 sprite.y -= self.src_rect.height / 4 if position == 0 sprite.y += self.src_rect.height / 4 if position == 2 end sprite.x += cell_data[i, 1] sprite.y += cell_data[i, 2] ################################################################ sprite.z = sprite.y # 和动画本体的Y挂钩 #sprite.z = self.z # 和调用者的Z一样 # 如果位置是画面就和默认一样2000 sprite.z = 2000 if position == 3 ################################################################ 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.angle = cell_data[i, 4] sprite.mirror = (cell_data[i, 5] == 1) sprite.opacity = cell_data[i, 6] * self.opacity / 255.0 sprite.blend_type = cell_data[i, 7] end end end end
module RPG
class Sprite < ::Sprite
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites[ i ]
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
sprite.y = self.viewport.rect.height - 160
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x - self.ox + self.src_rect.width / 2
sprite.y = self.y - self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
################################################################
sprite.z = sprite.y # 和动画本体的Y挂钩
#sprite.z = self.z # 和调用者的Z一样
# 如果位置是画面就和默认一样2000
sprite.z = 2000 if position == 3
################################################################
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.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end
|