Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> 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
   
Night5h4d3
post Dec 13 2011, 05:18 AM
Post #2


The past tense
Group Icon

Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed




Well, I cant give any working code atm, but I can point you in the right direction - a few snippets to help you with some of the algorithms.

you'll want a def that cycles through the images, and that times the duration shown. Now, for cycling through 9/10 images, first, I recommend you use an array and loop to create and store the images it's incredibly smaller and easier to handle:

CODE
@imgs = []
for i in 0...N
  @imgs.push(Sprite.new)
  @imgs[i].bitmap = RPG::Cache.picture("img" + (i + 1))
  @imgs[i].x = 0
end


Replace N with however many images you want.

You'll want an incrementor variable, place it somewhere in main or initialize:
CODE
@i = 0



And when it comes to cycling a new image, you'll want something along the lines of:
CODE
if Graphics.frame_count % 80 == 0  # occurs every 80 frames
  @i += 1 # increment the var
  show_image(@imgs[(@i % N)] )
  # 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


Hope that makes sense, by the way.80 frames is 1.3 seconds.


__________________________
Got 30 minutes? Then you've enough time to play this awesome game:

- potentially promising project page
- thanks holder
My growing space of user-bars:

about me:







I made the following!





Go to the top of the page
 
+Quote Post
   
SleepingSirenx
post Dec 14 2011, 05:28 AM
Post #3


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
   
maximusmaxy
post Dec 14 2011, 06:47 AM
Post #4


PZE whore
Group Icon

Group: Revolutionary
Posts: 131
Type: Scripter
RM Skill: Skilled




I actually wrote a script to do this recently for the PZE but decided not to release because it's almost impossible to use if you don't know anything about scripting. It allows you to do much more elaborate title scenes with moving sprites ect. It may be of some help, feel free to use it. http://www.mediafire.com/?hnnn4a5v91nq6gv


__________________________
Check out the new PZE Forums! http://zeldaengine.net/index.php
Go to the top of the page
 
+Quote Post
   
SleepingSirenx
post Dec 14 2011, 10:28 PM
Post #5


The SMT Maniac
Group Icon

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




This is perfect! Thank you Mr. maximusmaxy! I have no problem understanding and configurating this code to my needs, so I suggest you release it, this will help others greatly. Thank you very much again. smile.gif


__________________________

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: 24th May 2013 - 05:58 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker