范例:
脚本:
- #华丽的图片过渡 1.0#by 赤点#使用方法看事件里的设置#现在只支持640@480的图片class Sprc def self.change1(bitmap) v1 = Viewport.new(-320, 0,320,480) v2 = Viewport.new(640, 0,320,480) @tem1 = Sprite.new(v1) @tem2 = Sprite.new(v2) @tem1.bitmap = bitmap @tem2.bitmap = bitmap @tem2.x = -320 loop do Graphics.update @tem1.viewport.rect.x += 8#速度可以自己挑,值越大越快 @tem2.viewport.rect.x -= 8 if @tem1.viewport.rect.x >= 0 break end end end def self.dispose1(bitmap) v1 = Viewport.new(0, 0,320,480) v2 = Viewport.new(320, 0,320,480) tem1 = Sprite.new(v1) tem2 = Sprite.new(v2) tem1.bitmap = bitmap tem2.bitmap = bitmap tem2.x = -320 @tem1.dispose @tem2.dispose loop do Graphics.update tem1.viewport.rect.x -= 8#速度可以自己挑,值越大越快 tem2.viewport.rect.x += 8 if tem2.viewport.rect.x >= 640 tem1.bitmap.dispose tem2.bitmap.dispose break end end end def self.change2(bitmap) v1 = Viewport.new(0, -480,320,480) v2 = Viewport.new(320, 480,320,480) @tem1 = Sprite.new(v1) @tem2 = Sprite.new(v2) @tem1.bitmap = bitmap @tem2.bitmap = bitmap @tem2.x = -320 loop do Graphics.update @tem1.viewport.rect.y += 8#速度可以自己挑,值越大越快 @tem2.viewport.rect.y -= 8 if @tem1.viewport.rect.y >= 0 break end end end def self.dispose2(bitmap) v1 = Viewport.new(0, 0,320,480) v2 = Viewport.new(320, 0,320,480) tem1 = Sprite.new(v1) tem2 = Sprite.new(v2) tem1.bitmap = bitmap tem2.bitmap = bitmap tem2.x = -320 @tem1.dispose @tem2.dispose loop do Graphics.update tem1.viewport.rect.y -= 8#速度可以自己挑,值越大越快 tem2.viewport.rect.y += 8 if tem2.viewport.rect.y >= 480 tem1.bitmap.dispose tem2.bitmap.dispose break end end end def self.change3(bitmap) v1 = Viewport.new(0, -240,640,240) v2 = Viewport.new(0, 480,640,240) @tem1 = Sprite.new(v1) @tem2 = Sprite.new(v2) @tem1.bitmap = bitmap @tem2.bitmap = bitmap @tem2.y = -240 loop do Graphics.update @tem1.viewport.rect.y += 8 @tem2.viewport.rect.y -= 8#速度可以自己挑,值越大越快 if @tem1.viewport.rect.y >= 0 break end end end def self.dispose3(bitmap) v1 = Viewport.new(0, 0,640,240) v2 = Viewport.new(0, 240,640,240) tem1 = Sprite.new(v1) tem2 = Sprite.new(v2) tem1.bitmap = bitmap tem2.bitmap = bitmap tem2.y = -240 @tem1.dispose @tem2.dispose loop do Graphics.update tem1.viewport.rect.y -= 8#速度可以自己挑,值越大越快 tem2.viewport.rect.y += 8 if tem2.viewport.rect.y >= 480 break end end end def self.change4(bitmap) v1 = Viewport.new(-640, 0,640,240) v2 = Viewport.new(640, 240,640,240) @tem1 = Sprite.new(v1) @tem2 = Sprite.new(v2) @tem1.bitmap = bitmap @tem2.bitmap = bitmap @tem2.y = -240 loop do Graphics.update @tem1.viewport.rect.x += 8#速度可以自己挑,值越大越快 @tem2.viewport.rect.x -= 8 if @tem1.viewport.rect.x >= 0 break end end end def self.dispose4(bitmap) v1 = Viewport.new(0, 0,640,240) v2 = Viewport.new(0, 240,640,240) tem1 = Sprite.new(v1) tem2 = Sprite.new(v2) tem1.bitmap = bitmap tem2.bitmap = bitmap tem2.y = -240 @tem1.dispose @tem2.dispose loop do Graphics.update tem1.viewport.rect.x -= 8#速度可以自己挑,值越大越快 tem2.viewport.rect.x += 8 if tem2.viewport.rect.x >= 640 break end end end end复制代码
复制代码 本帖来自P1论坛作者赤点,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:
https://rpg.blue/forum.php?mod=viewthread&tid=130347 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。