Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Help With Animated Scene.
SleepingSirenx
post Dec 13 2011, 04:20 AM
Post #1


The SMT Maniac
Group Icon

Group: Revolutionary
Posts: 125
Type: Developer
RM Skill: Undisclosed




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. smile.gif

Code :
Introduction Script
CODE
#==============================================================================#
# Introduction Script                                                          #
#==============================================================================#

# * Define SSX Module
module SSX
#Transition Type(Name).  
TRANSPNG = "006-Stripe02"  
end

class Introduction_Scene
#--------------------------------------------------------------------------
# Main
#--------------------------------------------------------------------------
  def main
    @img1 = Sprite.new
    @img1.bitmap = RPG::Cache.picture("img1")
    @img1.x = 0
    @img2 = Sprite.new
    @img2.bitmap = RPG::Cache.picture("img2")
    @img2.x = 0
    @img3 = Sprite.new
    @img3.bitmap = RPG::Cache.picture("img3")
    @img3.x = 0
    @img4 = Sprite.new
    @img4.bitmap = RPG::Cache.picture("img4")
    @img4.x = 0
    @img5 = Sprite.new
    @img5.bitmap = RPG::Cache.picture("img5")
    @img5.x = 0
    @img6 = Sprite.new
    @img6.bitmap = RPG::Cache.picture("img6")
    @img6.x = 0
    @img7 = Sprite.new
    @img7.bitmap = RPG::Cache.picture("img7")
    @img7.x = 0
    @img8 = Sprite.new
    @img8.bitmap = RPG::Cache.picture("img8")
    @img8.x = 0
    @img9 = Sprite.new
    @img9.bitmap = RPG::Cache.picture("img9")
    @img9.x = 0
    @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
       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

#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
  def update
    @mnpan.ox += 1
    @mnpan2.ox -= 1
    @mnpan2.oy += 1
  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
end


__________________________

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!
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
SleepingSirenx
post Dec 14 2011, 05:28 AM
Post #2


The SMT Maniac
Group Icon

Group: Revolutionary
Posts: 125
Type: Developer
RM Skill: Undisclosed




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. smile.gif

EDIT : Here's now the said code after inserting what you told me.

CODE
#==============================================================================#
# Introduction Script                                                          #
#==============================================================================#

# * Define SSX Module
module SSX
#Transition Type(Name).  
TRANSPNG = "006-Stripe02"  
end

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

#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
  def update
    @mnpan.ox += 1
    @mnpan2.ox -= 1
    @mnpan2.oy += 1
    
  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!
Go to the top of the page
 
+Quote Post
   



Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th June 2013 - 01:12 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker