Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # THEOALLEN - SPLASH SCREEN
- # VERSION : 1.0
- # CONTACT : www.rpgmakerid.com
- # (This script documentation is written in informal indonesian language)
- # =============================================================================
- $imported = {} if $imported.nil?
- $imported[:Theo_Splash] = true
- # =============================================================================
- =begin
- PENGENALAN :
- Script ini untuk bikin splash screen sebelum title
- CARA PAKAI :
- Taruh script ini di atas main dan dibawah materials.
- Pastikan gambar2 yang nantinya u pake buat splash screen ditaruh di folder
- Graphics/picture
- TERMS OF USE :
- Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
- keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
- dipake buat komersil, jangan lupa, gw dibagi gratisannya.
- =end
- # =============================================================================
- # KONFIGURASI :
- # =============================================================================
- module THEO
- module Splash
- SPLASH_BGM = "Theme2" # Nama file untuk lagu splash screen
- BGM_VOLUME = 100 # Volume lagu
- BGM_PITCH = 100 # Pitch lagu
- SPLASH_ARRAY = [ # <-- Jangan dihapus
- # Atur banyaknya gambar yg muncul dalam splash screen disini
- # Untuk fadein, wait, ama fadeout angka dalam satuan frame. Dalam artian,
- # jika u tulis 60, maka waktu yg dibutuhkan = 1 detik
- # ["ImageName", fadein, wait, fadeout],
- ["test" , 60, 120, 15],
- ["test" , 120, 120, 10],
- # Tambahin sendiri
- ] # <-- Jangan dihapus
- end
- end
- # =============================================================================
- if true # <-- untuk nge-disable, ganti true dengan false
- # -----------------------------------------------------------------------------
- # Batas akhir konfigurasi. Jangan diedit setelah line ini kecuali ente ngerti
- # =============================================================================
- class Splash_Screen < Scene_Base # class untuk splash screen
- # ---------------------------------------------------------------------------
- # Starting Scene
- # ---------------------------------------------------------------------------
- def start
- super
- @count = 0 # hitungan frame
- @stage = 0 # stage gambar
- @fadein = 0.0 # kecepatan fadein
- @fadeout = 0.0 # kecepatan fadeout
- create_image_arrays
- play_bgm
- determine_fade_speed
- end
- # ---------------------------------------------------------------------------
- # Bikin array gambar2 splash screen
- # ---------------------------------------------------------------------------
- def create_image_arrays
- @images = []
- splash_arrays.each do |splash|
- img = Sprite.new(@viewport)
- img.bitmap = Cache.picture(splash[0])
- img.opacity = 0
- @images.push(img)
- end
- end
- # ---------------------------------------------------------------------------
- # Nentuin kecepatan fade
- # ---------------------------------------------------------------------------
- def determine_fade_speed
- @fadein = 255 / splash_arrays[@stage][1].to_f
- @fadeout = 255 / splash_arrays[@stage][3]
- end
- # ---------------------------------------------------------------------------
- # Puter musik splash screen
- # ---------------------------------------------------------------------------
- def play_bgm
- name = sprintf("Audio/BGM/%s",THEO::Splash::SPLASH_BGM)
- vol = THEO::Splash::BGM_VOLUME
- pitch = THEO::Splash::BGM_PITCH
- Audio.bgm_play(name,vol,pitch)
- end
- # ---------------------------------------------------------------------------
- # Ambil array splash screen dari modul
- # ---------------------------------------------------------------------------
- def splash_arrays
- THEO::Splash::SPLASH_ARRAY
- end
- # ---------------------------------------------------------------------------
- # Update per frame
- # ---------------------------------------------------------------------------
- def update
- super
- @count += 1
- update_image
- if @count % max_duration == 0
- @images[@stage].dispose
- @count = 0
- @stage += 1
- if exit?
- exit_splash_screen
- return
- end
- determine_fade_speed
- end
- end
- # ---------------------------------------------------------------------------
- # Update opacity gambar
- # ---------------------------------------------------------------------------
- def update_image
- ary = splash_arrays[@stage]
- @images[@stage].opacity += @fadein.round if @count <= ary[1] && @images[@stage].opacity < 255
- @images[@stage].opacity -= @fadeout.round if @count > ary[1] + ary[2] && @images[@stage].opacity > 0
- end
- # ---------------------------------------------------------------------------
- # Masuk title screen
- # ---------------------------------------------------------------------------
- def exit_splash_screen
- SceneManager.goto(Scene_Title)
- end
- # ---------------------------------------------------------------------------
- # Syarat exit
- # ---------------------------------------------------------------------------
- def exit?
- @stage >= stage_max
- end
- # ---------------------------------------------------------------------------
- # Maksimum durasi satu gambar
- # ---------------------------------------------------------------------------
- def max_duration
- ary = splash_arrays[@stage]
- return ary[1] + ary[2] + ary[3]
- end
- # ---------------------------------------------------------------------------
- # Stage maksimal (panjang array gambar splash screen)
- # ---------------------------------------------------------------------------
- def stage_max
- splash_arrays.size
- end
- end
- # =============================================================================
- # Module SceneManager
- # =============================================================================
- module SceneManager
- # ---------------------------------------------------------------------------
- # Overwrite : Class Scene Pertama
- # ---------------------------------------------------------------------------
- def self.first_scene_class
- $BTEST ? Scene_Battle : Splash_Screen
- end
- end
- # =============================================================================
- end # <-- akhir dari disable state
- # =============================================================================
- #
- # END OF SCRIPT
- #
- # =============================================================================
Advertisement
Add Comment
Please, Sign In to add comment