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
> fading pictures in and right out again
j-frost
post Jan 19 2013, 11:30 AM
Post #1



Group Icon

Group: Member
Posts: 2
Type: Scripter
RM Skill: Advanced




Hello everybody,

I'm currently working on a Final Fantasy Tactics / Fire Emblem / Advance Wars like game. To implement the different phases (chiefly selection, player and enemy phases), I need to notify the player of the transition between the phases. To do this, I want to show a picture at 0 opacity, fade it in via move, wait 90 seconds, and fade it out again. I have so far implemented this successfully by putting an autorun event on the map. Now I wanted to transition to a script based approach, but I have not been able to get it to work.

So far, I have tried the following:
CODE
$game_map.screen.pictures[1].make(@phase)
20.times { Graphics.update }
$game_map.screen.pictures[1].fade_in
90.times { Graphics.update }
$game_map.screen.pictures[1].fade_out


with an extension to Game_Picture as follows:

CODE
# make simpler calls to pictures

class Game_Picture
  
  def make(phase)
    phase[0] = phase[0].capitalize[0]
    banner = phase + 'PhaseBanner'
    @name = banner
    @blend_type = 0
    @opacity = 0
  end
  
  def fade_in
    @target_opacity = 255
    @duration = 30
  end
  
  def fade_out
    @target_opacity = 0
    @duration = 60
  end
  
end


The above code does not work correctly. It does not cause a fade in animation; instead, the picture's opacity remains 0 until the fading out starts. I've tried using different wait methods and even threading the fading away from the main program as such:

CODE
$game_map.screen.pictures[1].make(@phase)
thread = Thread.new {
   $game_map.screen.pictures[1].fade_in
   sleep(3)
   $game_map.screen.pictures[1].fade_out
}
thread.join


I'm at a loss here as to what I might have overlooked.

Regards,

j-frost

This post has been edited by j-frost: Jan 20 2013, 04:17 AM
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Jan 20 2013, 04:03 AM
Post #2


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




Have you tried this configuration? If you don't update the map process, the opacity will never fade away, since there would be nobody to say the program what to do while the cycle goes through the Graphics updates...
Just add a $game_map.screen.pictures[1].update to update the picture's variables (opacity, wait time, et cetera) and a SceneManager.scene.update to update the Spriteset and that should work. I can't assure you a 100% rate of success, since I'm more RGSS - RGSS2 oriented, but this could surely be the problem.

CODE
$game_map.screen.pictures[1].make(@phase)
20.times { Graphics.update
$game_map.screen.pictures[1].update
SceneManager.scene.update
}
$game_map.screen.pictures[1].fade_in
90.times { Graphics.update
$game_map.screen.pictures[1].update
SceneManager.scene.update
}
$game_map.screen.pictures[1].fade_out


I hope this can help,

Jens


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
j-frost
post Jan 20 2013, 04:16 AM
Post #3



Group Icon

Group: Member
Posts: 2
Type: Scripter
RM Skill: Advanced




QUOTE (Jens of Zanicuud @ Jan 20 2013, 01:03 PM) *
Just add a $game_map.screen.pictures[1].update to update the picture's variables (opacity, wait time, et cetera) and a SceneManager.scene.update to update the Spriteset and that should work.

Thank you so much!! Updating the scene is actually exactly what I forgot to do, which caused it to optimize my code and jump to the next line of code after setting the variables in my Game_Picture.

For future reference:

Solution
CODE
$game_map.screen.pictures[1].make(@phase)
20.times { SceneManager.scene.update }
$game_map.screen.pictures[1].fade_in
90.times { SceneManager.scene.update }
$game_map.screen.pictures[1].fade_out


This post has been edited by j-frost: Jan 20 2013, 04:18 AM
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: 20th May 2013 - 06:24 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker