Well, I'm trying to make an Animated Introduction here. I've been successful ( I think ... ) for creating the animated background. Now all I need to do is to insert an Image, show it for about 80 Frames then make it fade out then show another image fading in, and the process goes on for about 9 or 10 images. Can someone help me with this?
So to get this straight here's the format of what I want to do ( but could not ) 1. Fade In Image 1 2. Image 1 stays on scene for about 80 frames. 3. Fade Out Image 1 4. Fade In Image 2 The cycle continues for about 9 or 10 Images.
I've included the script I'm working with, so If anyone can help, i will be gratefull. Thank you in advance.
I tried to do what you told me, then I get an error message saying " undefined method `+' for nil:NilClass. " and it's source of error came from the @i += 1. Wonder how can I fix this? Thank you for you help.
EDIT : Here's now the said code after inserting what you told me.
class Introduction_Scene #-------------------------------------------------------------------------- # Main #-------------------------------------------------------------------------- def imgs(imgs) @imgs = [] for i in 0..9 @i = 0 @imgs.push(Sprite.new) @imgs[i].bitmap = RPG::Cache.picture("img" + (i+1)) @imgs[i].x = 0 end end
def main @mnpan = Plane.new @mnpan.bitmap = RPG::Cache.picture("SakuraLogo") @mnpan.z = 2 @mnpan2 = Plane.new @mnpan2.bitmap = RPG::Cache.picture("SakuraLogo") @mnpan2.opacity = 120 @mnpan2.blend_type = 1 @mnpan2.z = 3 Graphics.transition(60, "Graphics/Transitions/" + SSX::TRANSPNG,1) loop do Graphics.update Input.update update img_update if $scene != self break end end for i in 1..50 @mnpan.zoom_x -= 0.01 @mnpan.zoom_y -= 0.01 @mnpan.ox -= 20 @mnpan.oy -= 10 @mnpan2.opacity += 5 @mnpan2.ox += 5 @mnpan2.oy += 5 @mnpan2.zoom_x += 0.01 @mnpan2.zoom_y += 0.01 Graphics.update end Graphics.freeze end
end # * Define Wait def wait(duration) @duration = duration end #* Define fade_out def fade_out self.opacity -= 48 end #* Define fade_in def fade_in self.opacity += 24 end def img_update if Graphics.frame_count % 80 == 0 # occurs every 80 frames @i += 1 # increment the var show_image(@imgs[(@i % 10)] ) # whatever you use to show the image, make sure it's image "(@i % N)" of the @imgs array. # where @i is the incrementor, % is modulous, and N is the number of images, # you can use @imgs.size for N here end end end
Thank you again.
This post has been edited by SleepingSirenx: Dec 14 2011, 05:29 AM
__________________________
My First Game .... Yeah .... ~♥ I'm In Need Of A Team To Help Me WIth The Development Of My Game PM Me. :) - DEMO's On Progress!
I Support This Projects!
Please Teach Me How To Script. :( I'm Learning How To Script. But Still Teach Me How To Script :) Damn THERMODYNAMICS! Makes My Head Spin!