赞 | 5 |
VIP | 620 |
好人卡 | 38 |
积分 | 69 |
经验 | 125468 |
最后登录 | 2015-7-27 |
在线时间 | 1666 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 6855
- 在线时间
- 1666 小时
- 注册时间
- 2008-10-29
- 帖子
- 6710
|
这个是像你那样更改不同的 sprite?window? 的 visible
- class Abc
- def initialize
- @sprites = []
- for i in 0..9
- sprite = Sprite.new
- sprite.visible = false
- sprite.z = 6000
- sprite.y = 448
- sprite.bitmap = Bitmap.new(640, 32)
- sprite.bitmap.fill_rect(0,0,640,32,Color.new(i*30+15,255,0,(5-i).abs*50+5))
- @sprites.push(sprite)
- end
- @wait_count = 3
- @src_index = 0
- @sprites[@src_index].visible = true
- end
- def update
- @sprites[@src_index].update
- if @wait_count > 0
- @wait_count -= 1
- return
- end
- @sprites[@src_index].visible = false
- @wait_count = 3
- @src_index += 1
- @src_index %= @sprites.size
- @sprites[@src_index].visible = true
- return
- end
- def dispose
- for sprite in @sprites
- sprite.bitmap.dispose
- sprite.dispose
- end
- end
- end
- class Scene_Map
- alias old_main main
- def main
- @abc = Abc.new
- old_main
- @abc.dispose
- end
- alias old_update update
- def update
- @abc.update
- old_update
- end
- end
复制代码 .
.这个是 只使用一个 sprite 不停的改变他的 bitmap
- $__logo_jump__.call if $__logo_jump__
- class Sprite_Logo < Sprite
- def initialize
- super
- self.x = 512
- self.z = 10000
- self.visible = true
- @bitmaps = Array.new
- for i in 0..9
- r = (5 - i).abs * 50 + 5
- g = 255
- b = 255 - (5 - i).abs * 50 + 5
- a = (5 - i).abs * 50 + 5
- clr = Color.new(r, g, b, a)
- bmp = Bitmap.new(128, 32)
- bmp.font.color = clr
- bmp.font.bold = true
- bmp.draw_text(0, 0, 128, 32, "66RPG", 1)
- @bitmaps.push(bmp)
- end
- @src_index = 0
- self.bitmap = @bitmaps[@src_index]
- @wait_count = 3
- end
- def update
- super
- if @wait_count > 0
- @wait_count -= 1
- return
- end
- @wait_count = 3
- @src_index += 1
- @src_index %= @bitmaps.size
- self.bitmap = @bitmaps[@src_index]
- return
- end
- def dispose
- for bitmap in @bitmaps
- bitmap.dispose
- end
- super
- end
- end
- module Kernel
- alias old_exit exit
- def exit(*args)
- $logo.dispose
- old_exit(*args)
- end
- end
- class << Graphics
- alias old_update update
- def update
- old_update
- $logo.update
- end
- end
- $logo = Sprite_Logo.new
- callcc{|$__logo_jump__|}
复制代码 当然啦,这2个脚本其实是一个原理.
我做的是无限的循环.不知道你是不是要的这种动画的效果.
这2个脚本可以同时运行.放到新工程里看看吧.
|
评分
-
查看全部评分
|