Project1
标题:
【鸡肋】播放动画
[打印本页]
作者:
恐惧剑刃
时间:
2013-12-22 13:42
标题:
【鸡肋】播放动画
本帖最后由 恋′挂机 于 2013-12-22 13:50 编辑
举例,在Title main里
@a = Magic.new(100, 100)
@a.loop_animation(1)
下方
@a.dispose
update里
@a.update
鸡肋不解释!!!只是个人喜好不想直接 RPG::Sprite.new
@magic
=begin
by 薄凉看客
鸡肋
Magic类
方法(RPG::Sprite)
set(x, y, z) 坐标调整
animation(animation_id, hit) 播发动画
animation_id 为动画ID
hit 为真则进行击中的处理,为伪则进行 MISS 的处理。
loop_animation(animation_id) 循环播发动画
animation_id 为动画ID
dispose 释放动画
update 刷新动画
属性
magic(RPG::Sprite.new)
pause 暂停标志
=end
class Magic
attr_reader :magic
attr_accessor :pause
def initialize(*arg)
@magic = RPG::Sprite.new
@magic.x,@magic.y,@magic.z = arg[0],arg[1],arg[2] == nil ? 2000 : arg[2]
@pause = false
end
def set(*arg)
@magic.x,@magic.y,@magic.z = arg[0],arg[1],arg[2] == nil ? 2000 : arg[2]
end
def animation(*arg)
magic = $data_animations[arg[0]]
@magic.animation(magic, arg[1])
end
def loop_animation(*arg)
magic = $data_animations[arg[0]]
@magic.loop_animation(magic)
end
def dispose
@magic.dispose
end
def update
@magic.update if @pause == false
end
def move(*arg)
[*1..arg[0]].each{|frame| @magic.x += arg[1] ; @magic.y += arg[2] ;
Graphics.update ; Input.update ; $scene.update}
end
end
复制代码
作者:
天地有正气
时间:
2013-12-26 09:39
脚本很高深的样子。。。看不懂。。。。
是可以用脚本播放动画吗?那样可方便多了。。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1