Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 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
   

Posts in this topic


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: 23rd May 2013 - 05:17 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker