Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # TheoAllen - Custom Title Command
- # Version : 1.0
- # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
- # (This script documentation is written in informal indonesian language)
- # =============================================================================
- ($imported ||= {})[:Theo_CustomTitle] = true
- # =============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # 2013.08.23 - Finished script
- # =============================================================================
- =begin
- Perkenalan :
- Script ini ngebikin kamu bisa ngebikin command dalam title screen pake
- gambar (bukan window)
- Cara penggunaan :
- Pasang dibawah material namun diatas main
- Edit konfignya.
- 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.
- Note :
- Script ini kemungkinan besar ngga kompet ama segala yg ngerubah title command
- atau kontrol input dalam title screen (misalnya press start)
- =end
- # =============================================================================
- # Konfigurasi :
- # =============================================================================
- module THEO
- module Title
- # ------------------------------------------------------------------------
- # Grafis untuk command harus ada di Graphics/system
- # ------------------------------------------------------------------------
- module Start # Untuk start
- Unselect = "new"
- Select = "new_selected"
- Position = [150,250] # posisi [x,y]
- end
- module Continue # Untuk continue / load
- Unselect = "continue"
- Select = "continue_selected"
- Position = [150,300] # posisi [x,y]
- end
- module Exit # Untuk exit / shutdown
- Unselect = "exit"
- Select = "exit_selected"
- Position = [150,350] # posisi [x,y]
- end
- end
- end
- # =============================================================================
- # Akhir dari konfigurasi :
- # =============================================================================
- class TitleCommandset
- attr_reader :commands
- include THEO::Title
- def initialize(viewport)
- @index = 0
- @viewport = viewport
- @active = true
- make_spriteset
- update_selection
- end
- def make_spriteset
- @commands = []
- @commands.push(TitleCommand.new(Start,@viewport))
- @commands.push(TitleCommand.new(Continue,@viewport))
- @commands.push(TitleCommand.new(Exit,@viewport))
- end
- def update
- return unless @active
- update_index
- update_scene if Input.trigger?(:C)
- end
- def update_selection
- @commands.each {|cmd| cmd.unselect}
- @commands[@index].select
- end
- def update_index
- if Input.repeat?(:UP)
- Sound.play_cursor
- @index -= 1
- wrap_index
- update_selection
- elsif Input.repeat?(:DOWN)
- Sound.play_cursor
- @index += 1
- wrap_index
- update_selection
- end
- end
- def wrap_index
- @index = 0 if @index > max_index
- @index = max_index if @index < 0
- end
- def max_index
- return 2
- end
- def update_scene
- @active = @commands[@index].call
- end
- def dispose
- @commands.each {|cmd| cmd.dispose}
- end
- end
- class TitleCommand < Sprite
- def initialize(mod,viewport)
- super(viewport)
- @mod = mod
- self.z = 200
- update_pos
- end
- def set_handler(method, enable = true)
- @handler = method
- @enable = enable
- end
- def unselect
- self.bitmap = Cache.system(@mod::Unselect)
- end
- def select
- self.bitmap = Cache.system(@mod::Select)
- end
- def update_pos
- self.x = @mod::Position[0]
- self.y = @mod::Position[1]
- end
- def call
- if @enable
- Sound.play_ok
- @handler.call
- return false
- else
- Sound.play_buzzer
- return true
- end
- end
- end
- class Scene_Title < Scene_Base
- def create_command_window
- @sprites = TitleCommandset.new(@viewport)
- @sprites.commands[0].set_handler(method(:command_new_game))
- @sprites.commands[1].set_handler(method(:command_continue),load_enable?)
- @sprites.commands[2].set_handler(method(:command_shutdown))
- end
- def load_enable?
- DataManager.save_file_exists?
- end
- def close_command_window
- end
- alias theo_custom_title_update update
- def update
- theo_custom_title_update
- @sprites.update
- end
- alias theo_custom_title_term terminate
- def terminate
- theo_custom_title_term
- @sprites.dispose
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment