设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索

[已解决]如何让对象方动画固定Y坐标,固定行

查看数: 2830 | 评论数: 2 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2020-3-29 15:31

正文摘要:

本帖最后由 miantouchi 于 2020-4-5 22:18 编辑 如图,敌人图片大的话动画就高,敌人小的话动画就低,我想让这个动画固定Y坐标行,不知道从哪里改。 不然感觉很不齐,有高有低的。 ...

回复

灯笼菜刀王 发表于 2020-3-29 17:05:31
本帖最后由 灯笼菜刀王 于 2020-3-29 17:06 编辑
  1.     def animation_set_sprites(sprites, cell_data, position)
  2.       for i in 0..15
  3.         sprite = sprites[i]
  4.         pattern = cell_data[i, 0]
  5.         if sprite == nil or pattern == nil or pattern == -1
  6.           sprite.visible = false if sprite != nil
  7.           next
  8.         end
  9.         sprite.visible = true
  10.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  11.         if position == 3
  12.           if self.viewport != nil
  13.             sprite.x = self.viewport.rect.width / 2
  14.             sprite.y = self.viewport.rect.height - 160
  15.           else
  16.             sprite.x = 320
  17.             sprite.y = 240
  18.           end
  19.         else
  20.           sprite.x = self.x - self.ox + self.src_rect.width / 2
  21.           sprite.y = self.y - self.oy + self.src_rect.height / 2
  22.           sprite.y -= self.src_rect.height / 4 if position == 0
  23.           sprite.y += self.src_rect.height / 4 if position == 2
  24.         end
  25.         sprite.x += cell_data[i, 1]
  26.         sprite.y += cell_data[i, 2]
  27.         sprite.z = 2000
  28.         sprite.ox = 96
  29.         sprite.oy = 96
  30.         sprite.zoom_x = cell_data[i, 3] / 100.0
  31.         sprite.zoom_y = cell_data[i, 3] / 100.0
  32.         sprite.angle = cell_data[i, 4]
  33.         sprite.mirror = (cell_data[i, 5] == 1)
  34.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  35.         sprite.blend_type = cell_data[i, 7]
  36.       end
  37.     end
复制代码


坐标在这里, 自己琢磨琢磨怎么折腾   position 就是动画设置里"0上,1中,2下,3画面"

评分

参与人数 2星屑 +50 +1 收起 理由
miantouchi + 1 认可答案
RyanBern + 50 认可答案

查看全部评分

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-7-19 13:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表