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

Project1

 找回密码
 注册会员
搜索

光标替换动画

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

正文摘要:

如图,下面的光标如何改成动画显示,默认光标太难看了。。。 RUBY 代码复制#==============================================================================# ■ Window_SaveFile ...

回复

黑米馒头 发表于 2022-9-5 23:03:30
灯笼菜刀王 发表于 2022-9-5 22:09
上面那个脚本改了, 用新的试试, 注意设置变了

又上传不了图片了……

把脚本放到Rgu的工程里,就显示这样,啥情况…

Script '111' line 1: TypeError occured.
superclass mismatch for class Window SaveFile

点评

把你原来的脚本复原吧, 重新修改了下做法  发表于 2022-9-5 23:26
你这个Window_SaveFile还有别的地方用么=.= ...  发表于 2022-9-5 23:25
灯笼菜刀王 发表于 2022-9-5 22:09:09
黑米馒头 发表于 2022-9-5 12:23
现在可以进存档界面了,不过动画坐标修改了没用,一直固定在左上脚

...

上面那个脚本改了, 用新的试试, 注意设置变了

点评

完美解决  发表于 2022-9-6 12:25
你自己在12行加一句 self.z = 10086 就行了  发表于 2022-9-6 09:55
能否给动画加个Z坐标,现在被人物挡住了  发表于 2022-9-6 07:59
呃, 0.500 会被视为0.5, 是我没考虑周到=.= 算了, 用数组吧, 不搞奇怪操作了, 重新更新了下脚本,再试试  发表于 2022-9-5 23:22
我这么改@ary = [100.500,150.500,200.500,250.500,300.500,350.500],Y坐标没效果  发表于 2022-9-5 22:27
灯笼菜刀王 发表于 2022-9-5 10:55:45
黑米馒头 发表于 2022-9-5 09:13
@arw = Sprite_arw.new(12,20.20,30.30,40.40) #

呃, 父类不是window_selectable 啊.....

20行改成 @arw.set_xy(@file_index) 试试
灯笼菜刀王 发表于 2022-9-4 23:52:46
本帖最后由 灯笼菜刀王 于 2022-9-5 23:31 编辑

RUBY 代码复制
  1. class Spr_SaveFile < RPG::Sprite
  2.   def initialize(file_index)
  3.     @ary = [[1,1],[2,2],[3,3]] #这里写你的坐标数组
  4.     @t = 4  #这里写你的动画帧数比如4帧
  5.     super()
  6.     self.bitmap = RPG::Cache.windowskin("cursor.png")
  7.     @wh = self.bitmap.width / @t
  8.     @w = 0
  9.     self.src_rect.set(0,0,@wh,self.bitmap.height)
  10.     set_xy(file_index)
  11.     self.visible = false
  12.   end
  13.   def set_xy(index)
  14.     f = @ary[index] || [0,0]
  15.     self.x,self.y = f[0].to_i,f[1].to_i
  16.   end
  17.   def update
  18.     super
  19.     if Graphics.frame_count % 4 == 0
  20.       @w = (@w + 1) % @t
  21.     end
  22.     self.src_rect.set(@w * @wh,0,@wh,self.bitmap.height)
  23.   end
  24. end
  25.  
  26. class Window_SaveFile < Window_Base
  27.   alias oldinitialize initialize
  28.   def initialize(file_index, filename)
  29.     oldinitialize(file_index, filename)
  30.     @aw = Spr_SaveFile.new(file_index)
  31.     self.cursor_rect.empty
  32.   end
  33.   def update_cursor_rect
  34.     @aw.visible = @selected
  35.   end
  36.   def dispose
  37.     super
  38.     @aw.dispose
  39.   end
  40.   def update
  41.     super
  42.     @aw.update
  43.   end
  44. end


用法, 把你的光标动画切成宽高一致的数张图片,并排成一横排合并成一张, 命名为cursor.png 放到 Windowskin 文件夹里
        然后把上面的脚本塞到你这个脚本下面

设置: 在第3行数组里写你的坐标数值, 以数组写法 即 [123,456]  表示 X坐标123, Y坐标456
         在第4行写你的动画帧数
        
应该可以了吧

评分

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

查看全部评分

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

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

GMT+8, 2024-5-21 09:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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