Project1
标题:
[已解决]如何让对象方动画固定Y坐标,固定行
[打印本页]
作者:
miantouchi
时间:
2020-3-29 15:31
标题:
[已解决]如何让对象方动画固定Y坐标,固定行
本帖最后由 miantouchi 于 2020-4-5 22:18 编辑
如图,敌人图片大的话动画就高,敌人小的话动画就低,我想让这个动画固定Y坐标行,不知道从哪里改。
不然感觉很不齐,有高有低的。
作者:
灯笼菜刀王
时间:
2020-3-29 17:05
本帖最后由 灯笼菜刀王 于 2020-3-29 17:06 编辑
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 = 2000
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
复制代码
坐标在这里, 自己琢磨琢磨怎么折腾 position 就是动画设置里"0上,1中,2下,3画面"
作者:
miantouchi
时间:
2020-3-29 19:53
灯笼菜刀王 发表于 2020-3-29 17:05
坐标在这里, 自己琢磨琢磨怎么折腾 position 就是动画设置里"0上,1中,2下,3画面" ...
搞定了,话说最近和RPG::Sprite这个类干上了,
@_animation这个变量为啥能用,我也是迷迷糊糊的。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X5.0