加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 Mono_kyrin 于 2018-11-19 03:50 编辑
想做一个樱花飘飘落下的天气效果,又不想用动画做(毕竟整个素材300多帧……),于是想直接用脚本更新精灵实例解决。
问题解决了,那就作为一个实例分享吧,调用方法在五楼
帧动画图片存放在Graphics/sakura下,命名为emm_3990-0.png 到 emm_3990-306.png
class Scene_Sakura def initialize() @count = 0 @sprite = nil @viewport = Viewport.new(0,0,640,480) @sprite = Sprite.new(@viewport) @viewport.z = 1000 @sprite.x = 0 @sprite.y = 0 @sprite.zoom_x = 1.5 @sprite.zoom_y = 1.5 @sprite.blend_type = 1 @sprite.visible = true @sprite.mirror = true @bitmaps = [] for i in 0..306 @bitmaps.push(Bitmap.new("Graphics/sakura/emm_3990-#{i}.png")) end @sprite.bitmap = @bitmaps[@count] end def update @count += 0.5 @sprite.bitmap = @bitmaps[@count.round] if @count == 306 @count = 0 end end end
class Scene_Sakura
def initialize()
@count = 0
@sprite = nil
@viewport = Viewport.new(0,0,640,480)
@sprite = Sprite.new(@viewport)
@viewport.z = 1000
@sprite.x = 0
@sprite.y = 0
@sprite.zoom_x = 1.5
@sprite.zoom_y = 1.5
@sprite.blend_type = 1
@sprite.visible = true
@sprite.mirror = true
@bitmaps = []
for i in 0..306
@bitmaps.push(Bitmap.new("Graphics/sakura/emm_3990-#{i}.png"))
end
@sprite.bitmap = @bitmaps[@count]
end
def update
@count += 0.5
@sprite.bitmap = @bitmaps[@count.round]
if @count == 306
@count = 0
end
end
end
|