#=============================================================================== # LOGO SCENE #=============================================================================== # Author: Holy87 # Version: 1.2 # User difficulty: ★★ #------------------------------------------------------------------------------- # This script uses to show a serial of images at game's opening, like author's # signature/logo, messages, movies etc. # The script allows to: # ● Show so many images you want # ● Jump in any moment to title screen pressing Enter # ● Set for every image the transition timing and effects # ● Play title screen BGM from the logo scene # ● Play movies and SE # ● Automatically hide the logo if is a play test. #------------------------------------------------------------------------------- # Instructions: # Copy this script under materials and above the Main. # Images must be placed in the Graphics\Pictures folder. The images will be # automatically centered on the screen. # #------------------------------------------------------------------------------- # Compatibility: # Scene Manager -> alias of first_scene_class method. #------------------------------------------------------------------------------- module H87_logo_shower #=============================================================================== # ** CONFIGURATION ** #=============================================================================== Logos = { # Insert here in the proprer order the images to show, how much time will be # enndure (in frame) and if activate or not the transition effect #type: 0-> Normal fade # 1-> Normal zoom # 2-> Horizontal zoom # 3-> Vertical zoom # 4-> Increspature # If you want to use a movie, you need only to insert the movie name # (make sure that there are no pictures with the same name) # You can also insert a phrase instead of the name, and that will be shown # like a picture # You can go to a new line with the "|"" character #ID Name Timing Type SE 1 => ["Logo", 100, 0], 2 => ["Initial Logo|created by Holy87", 70, 1, "Applause1"], 3 => ["Video"], 4 => ["Logo3", 150, 4], } # do not remove! # P.S. The timing start after the transition is ended. #Do you want to play the title screen music? Play_music = true #Fade speed Fade_time = 50 #Fade timing of the last image Final_fade = 80 #Jump the logo screen when in test mode? Jump_test = true #Do you want the black background or white? White = false #true if do you want it white #Insert the font name for phrases: Logo_Font = "Comic Sans MS" #============================================================================ # ** END OF CONFIGURATION ** # Don't modify the script below if you don't know what you're doing. #============================================================================ $imported = {} if $imported == nil $imported["H87_Logoshower"] = true #-------------------------------------------------------------------------- # * returns the fade speed #-------------------------------------------------------------------------- def fade_speed return 255.0 / Fade_time end #-------------------------------------------------------------------------- # * returns the fade speed after the last image #-------------------------------------------------------------------------- def final_fade_speed return 255.0 / Final_fade end end # modulo #=============================================================================== # ** Class Scene_Logo #=============================================================================== class Scene_Logo < Scene_Base include H87_logo_shower # <- module #-------------------------------------------------------------------------- # * start #-------------------------------------------------------------------------- def start super $logo_done = true # flag that indicates the logo appeared create_logo_graphic # logo graphic creation play_title_music if Play_music # play title music end #-------------------------------------------------------------------------- # * logo graphic creation #-------------------------------------------------------------------------- def create_logo_graphic @logo_base = Sprite.new @logo_base.opacity = 0 @logo_base.bitmap = new_base_bitmap @logo_counter = 1 # counter @time_counter = 0 # time_remaning @logo = Sprite.new # creation change_logo # bitmap update end #-------------------------------------------------------------------------- # * assignes the bitmap #-------------------------------------------------------------------------- def new_base_bitmap bitmap = Bitmap.new(Graphics.width, Graphics.height) colore = Color.new(255,255,255) bitmap.fill_rect(0,0,bitmap.width,bitmap.height,colore) if White return bitmap end #-------------------------------------------------------------------------- # * Changes the logo and create a new bitmap #-------------------------------------------------------------------------- def change_logo if Logos[@logo_counter][1].nil? Graphics.play_movie("Movies/"+Logos[@logo_counter][0]) else RPG::SE.new(Logos[@logo_counter][3]).play if Logos[@logo_counter][3] != nil initialize_logo_sprite preset_logo end end #-------------------------------------------------------------------------- # * reinitialization of logo attributes #-------------------------------------------------------------------------- def initialize_logo_sprite @logo.bitmap = logo_bitmap(Logos[@logo_counter][0]) @logo.opacity = 0 @logo.ox = @logo.width/2 # l'origine è al centro @logo.oy = @logo.height/2 # idem @logo.x = Graphics.width / 2 # centra l'immagine @logo.y = Graphics.height / 2 # idem @speed = 0 @logo.zoom_x = 1 @logo.zoom_y = 1 @logo.wave_speed = 0 @logo.wave_length = 0 end #-------------------------------------------------------------------------- # * imposta l'inizio del logo a seconda del tipo di comparsa #-------------------------------------------------------------------------- def preset_logo case Logos[@logo_counter][2] # caso when 1 @speed = 0.002 # velocità zoom @logo.zoom_x = 0.9 # proporzioni (solo del 10% più piccolo @logo.zoom_y = 0.9 # idem when 2 @speed = 0.01 @logo.zoom_x = 0 when 3 @speed = 0.01 @logo.zoom_y = 0 when 4 @speed = 1 @logo.wave_amp = 120 @logo.wave_length = 255 @logo.wave_speed = 360 end end #-------------------------------------------------------------------------- # * restituisce la bitmap del logo #-------------------------------------------------------------------------- def logo_bitmap(source) begin bitmap = Cache.picture(source) rescue Errno::ENOENT line_height = 40 text = source.split("|") bitmap = Bitmap.new(Graphics.width, Graphics.height) bitmap.font.color = White ? Color.new(0,0,0) : Color.new(255,255,255) bitmap.font.outline = false bitmap.font.size = 40 bitmap.font.name = Logo_Font starting_line = (Graphics.height - text.size*line_height) / 2 for i in 0..text.size-1 bitmap.draw_text(0,starting_line,bitmap.width,line_height,text[i],1) starting_line += line_height end end return bitmap end #-------------------------------------------------------------------------- # * sostituisce l'immagine con la prossima #-------------------------------------------------------------------------- def next_logo return if Logos[@logo_counter + 1] == nil @logo_counter += 1 @time_counter = 0 change_logo end #-------------------------------------------------------------------------- # * restituisce true se c'è un'altra immagine da mostrare #-------------------------------------------------------------------------- def there_next? return true if Logos[@logo_counter + 1] != nil return false end #-------------------------------------------------------------------------- # * aggiornamento #-------------------------------------------------------------------------- def update super jump_logo if Input.trigger?(:C) # aggiorna l'input update_fade_logo # aggiorna l'animazione end #-------------------------------------------------------------------------- # * aggiorna l'animazione dell'immagine #-------------------------------------------------------------------------- def update_fade_logo @logo_base.opacity += 20 process_appear process_fade end #-------------------------------------------------------------------------- # * processo di apparizione del logo #-------------------------------------------------------------------------- def process_appear case Logos[@logo_counter][2] when 1 if @logo.zoom_x < 1 @logo.zoom_x += @speed @logo.zoom_y += @speed end when 2 @logo.zoom_x += @speed if @logo.zoom_x < 1 when 3 @logo.zoom_y += @speed if @logo.zoom_y < 1 when 4 if @logo.wave_amp > 0 @logo.wave_amp -= @speed end @logo.update end end #-------------------------------------------------------------------------- # * processo di scomparsa del logo #-------------------------------------------------------------------------- def process_fade if Logos[@logo_counter][1] != nil and @time_counter < Logos[@logo_counter][1] # attesa frame @logo.opacity += fade_speed if @logo.opacity >= 255 @time_counter += 1 end else if there_next? @logo.opacity -= fade_speed else @logo.opacity -= final_fade_speed end if @logo.opacity == 0 if there_next? next_logo else go_title end end end end #-------------------------------------------------------------------------- # * finalmente, vai alla schermata del titolo #-------------------------------------------------------------------------- def go_title SceneManager.goto(SceneManager.h87f_s_c) end #-------------------------------------------------------------------------- # * fine #-------------------------------------------------------------------------- def terminate @logo.opacity = 0 super @logo_base.dispose @logo.bitmap.dispose @logo.dispose end #-------------------------------------------------------------------------- # * forza il title #-------------------------------------------------------------------------- def jump_logo loop do @logo.opacity -= 30 Graphics.update break if @logo.opacity == 0 end go_title end #-------------------------------------------------------------------------- # * esegue la musica del titolo #-------------------------------------------------------------------------- def play_title_music $data_system.title_bgm.play RPG::BGS.stop RPG::ME.stop end end # scene_logo #=============================================================================== # ** SceneManager #=============================================================================== module SceneManager class << self; alias h87f_s_c first_scene_class; end #-------------------------------------------------------------------------- # * modifica della schermata iniziale #-------------------------------------------------------------------------- def self.first_scene_class if $BTEST return h87f_s_c elsif $TEST and H87_logo_shower::Jump_test return h87f_s_c else return Scene_Logo end end end #scenemanager