PHP код:
	
#==============================================================================#
#  Select Screen                                                               #
#------------------------------------------------------------------------------#
#  Автор: HopeBree                                                             #
#  Для: RPGMAKER VX ACE                                                        #
#  Версия 2.0                                                                  #
#------------------------------------------------------------------------------#
#  18.09.2015 - Версия 2.0 - Скрипт переписан, добавлены новые опции           #
#------------------------------------------------------------------------------#
#  08.09.2015 - Версия 1.2 - Добавлено описание персонажа                      #
#  08.09.2015 - Версия 1.1 - Добавлены новые настройки:                        #
#                            ● Настройка графики                               #
#                            ● Воспроизведение фоновой музыки                  #
#                            ● Выбор id играбельных персонажей                 #
#  07.09.2015 - Версия 1.0 - Релиз                                             #
#==============================================================================#
# Меню выбора игрового персонажа. Появляется сразу же после начала новой игры. #
# Стандартные id персонажей 1 и 2. id соответствуют героям из базы данных.     #
#------------------------------------------------------------------------------#
# Для правильной работы скрипта, удалите всех персонажей из партии в базе      #
# данных.                                                                      #
# Скрипт использует дополнительную графику из папки                            #
#                                              \Graphics\System\Select Screen  #
# Графика портретов должны иметь имена "Actor 0" и "Actor 1".                  #
#==============================================================================#
module HB                                                                      #
#==============================================================================#
#================================#=============================================#
# Настройки                      # Описание                                    #
#================================#=============================================#
  CHARID        = [2,6]          # id персонажей из бд                         #
#--------------------------------#---------------------------------------------#
  USE_BGM       = true           # Использовать ли фоновую музыку              #
  BGM           = "Scene2"       # Фоновая музыка                              #
#--------------------------------#---------------------------------------------#
  BG            = "StarlitSky"   # Изображение фона                            #
  BG_SPEED      = [1,1]          # Скорость прокрутки фона [x,y]               #
#--------------------------------#---------------------------------------------#
  USE_CIRCLE    = true           # Использовать ли анимированный спрайт        #
  CIRCLE        = "cricle"       # Анимированный спрайт                        #
  CIRCLE_SPEED  = -0.1           # Скорость вращения спрайта                   #
#--------------------------------#---------------------------------------------#
  USE_LAYER     = true           # Использовать ли слой LAYER                  #
  LAYER         = "layer"        # "Самое верхнее" изображение                 #
#--------------------------------#---------------------------------------------#
  PARTICLE      = "Particles"    # Графика для частиц                          #
  NUMBER        = 30             # Количество частиц (отключенить - NUMBER = 0)#
  BLEND         = 1              # Тип наложения (0, 1 или 2)                  #
  RANDOM_COLOR  = true           # Разные цвета                                #
  RANGE_X       = 0              # Скорость по оси X                           #
  RANGE_Y       = 3              # Скорость по оси Y                           #
  RANGE_ANGLE   = 3              # Скорость вращения                           #
#--------------------------------#---------------------------------------------#
  LINE          = 2              # Кол-во строк в описании персонажа           #
  INFO          = [              #=============================================#
#------------------------------------------------------------------------------#
# Описание первого персонажа                                                   #
#------------------------------------------------------------------------------#
"Her father is a master assassin. Throughout her
youth, she mastered the techniques of fighting.",
#------------------------------------------------------------------------------#
# Описание второго персонажа                                                   #
#------------------------------------------------------------------------------#
"A girl who's brought up by forest spirits. She loves 
nature and protects the forest from disturbance."
#==============================================================================#
]                                                                              #
#==============================================================================#
end
#==============================================================================#
# Scene Select Screen                                                          #
#==============================================================================#
class Scene_Title
  def command_new_game
    close_command_window
    SceneManager.call(Scene_CharSellect)
  end
end
#==============================================================================#
# Cache                                                                        #
#==============================================================================#
module Cache
  def self.select_screen(filename)
    load_bitmap("Graphics/System/Select Screen/", filename)
  end
end
#==============================================================================
# ■ Scene CharSellect
#==============================================================================
class Scene_CharSellect      
  def main
    Graphics.update
    Graphics.freeze
    execute_setup
    execute_loop
    dispose
  end       
  def execute_setup
    @phase = 0
    @active = false
    @com_index = 0
    @com_index_old = @com_index
    @com_index_max = 1
    create_sprites
    create_help_window
  end     
  def execute_loop
    Graphics.update
    Graphics.transition(60)
    play_title_music
    loop do
      Input.update
      update
      Graphics.update
      break if SceneManager.scene != self
    end
  end
end
#==============================================================================
# ■ Scene Title
#==============================================================================
class Scene_CharSellect
  def create_sprites     
    create_background
    create_commands
    create_particles
  end
  def create_background
    @background1 = Plane.new
    @background1.bitmap = Cache.select_screen(HB::BG)
    @background1.z = 0
    if HB::USE_LAYER == true
      @background2 = Plane.new
      @background2.bitmap = Cache.select_screen(HB::LAYER)
      @background2.z = 11
    end
    if HB::USE_CIRCLE == true
      @background3 = Sprite.new
      @background3.bitmap = Cache.select_screen(HB::CIRCLE)
      @background3.z = 1
      @background3.x = Graphics.width / 2
      @background3.y = Graphics.height / 2
      @background3.ox = @background3.bitmap.width / 2
      @background3.oy = @background3.bitmap.height / 2
    end
    @actor1 = Sprite.new
    @actor1.bitmap = Bitmap.new(Graphics.width,Graphics.height)
    @actor1.z = 12
    @actor1.bitmap.draw_text(0, 5, Graphics.width / 2, 32, $game_actors[HB::CHARID[0]].name, 1)
    @actor2 = Sprite.new
    @actor2.bitmap = Bitmap.new(Graphics.width,Graphics.height)
    @actor2.z = 12
    @actor2.bitmap.draw_text(Graphics.width / 2, 5, Graphics.width / 2, 32, $game_actors[HB::CHARID[1]].name, 1)
    
    @background1.opacity = 0
    @background2.opacity = 0
    @background3.opacity = 0
    @actor1.opacity = 0
    @actor2.opacity = 0
  end         
  def create_commands
    @com = []
    for index in 0...2
      @com.push(Select_Commands.new(nil,index))
    end 
  end
  def create_particles
    return if !HB::NUMBER
    @viewport_light = Viewport.new(-32, -32, Graphics.width + 56, Graphics.height + 56)
    @viewport_light.z = 3
    @particles_bitmap =[]
    for i in 0...HB::NUMBER
      @particles_bitmap.push(Particle.new, @viewport_light)
    end
  end
end
#==============================================================================
# ■ Particles Title
#==============================================================================
class Particle < Sprite            
  def initialize(viewport = nil)
    super(viewport)
    self.bitmap = Cache.select_screen(HB::PARTICLE)
    self.tone.set(rand(255),rand(255), rand(255), 255) if HB::RANDOM_COLOR
    self.blend_type = HB::BLEND
    self.z = 3
    @cw = self.bitmap.width
    @ch = self.bitmap.height
    @nx = HB::RANGE_X
    @ny = HB::RANGE_Y
    reset_setting
  end              
  def reset_setting
    zoom = (50 + rand(100)) / 100.1
    self.zoom_x = zoom
    self.zoom_y = zoom
    self.x = (rand(Graphics.width + 32) -32)
    self.y = rand(Graphics.height + 32 + @ch) 
    self.opacity = 0
    self.angle = rand(360)
    nx2 = rand(@nx).abs
    nx2 = 1 if (@nx != 0 and nx2 < 1)      
    @speed_x = @nx > 0 ? nx2 : @nx < 0 ? -nx2 : 0        
    ny2 = rand(@ny).abs
    ny2 = 1 if (@ny != 0 and ny2 < 1)      
    @speed_y = @ny > 0 ? ny2 : @ny < 0 ? -ny2 : 0   
    @speed_a = [[rand(HB::RANGE_ANGLE), HB::RANGE_ANGLE].min, 0].max 
  end            
  def dispose
    super
    self.bitmap.dispose
  end              
  def update
    super
    self.x += @speed_x
    self.y -= @speed_y
    self.angle += @speed_a      
    self.opacity += 5
    reset_setting if can_reset_setting?
  end              
  def can_reset_setting?
    return true if (self.x < -64 or self.x > Graphics.width + 32)    
    return true if (self.y < -164 or self.y > Graphics.height + 32)
    return false
  end  
end
#==============================================================================
# ■ Title Commands
#==============================================================================
class Select_Commands < Sprite
  def initialize(viewport = nil,index)
    super(viewport)
    @index = index
    @active = 1
    @active_old = @active
    self.bitmap = Cache.select_screen("Actor " + index.to_s)
    self.x = Graphics.width / 2 * @index
    self.y = 0
    self.z = 10
    self.opacity = 0
    @alpha = 0
    self.color.set(0, 0, 0, @alpha)
  end
  def dispose_sprites
    self.bitmap.dispose
  end         
  def update_sprites(index,active)
    if self.x = Graphics.width / 2 * @index
      self.opacity += 15 if self.opacity < 255
    end
    if index == @index
      @alpha -= 25 if @alpha > 0
      self.color.set(0, 0, 0, @alpha) 
      @active = 0
    else
      @alpha += 25 if @alpha < 100
      self.color.set(0, 0, 0, @alpha)
      @active = 1
    end
  end
end
#==============================================================================
# ■ Scene Title
#==============================================================================
class Scene_CharSellect        
  def dispose
    Graphics.freeze
    dispose_background
    dispose_particles
    dispose_commands
    @help_window.dispose
  end          
  def dispose_background
    @background1.bitmap.dispose
    @background1.dispose
    @background2.bitmap.dispose
    @background2.dispose     
    @background3.bitmap.dispose
    @background3.dispose  
    @actor1.bitmap.dispose
    @actor1.dispose
    @actor2.bitmap.dispose
    @actor2.dispose
  end
  def dispose_commands
    @com.each {|sprite| sprite.dispose_sprites }
  end  
  def dispose_particles
    return if @particles_bitmap == nil
    @particles_bitmap.each {|sprite| sprite.dispose }
    @particles_bitmap = nil
    @viewport_light.dispose 
  end
end
#==============================================================================
# ■ Scene Title
#==============================================================================
class Scene_CharSellect         
  def update_sprites
    update_background
    update_particles
    update_commands
  end
  def update_background
    @background1.ox += HB::BG_SPEED[0]
    @background1.oy += HB::BG_SPEED[1]
    return if HB::USE_CIRCLE == false
      @background3.angle += HB::CIRCLE_SPEED
    @background1.opacity += 15
    @background2.opacity += 15
    @background3.opacity += 15
    @actor1.opacity += 15
    @actor2.opacity += 15
  end
  def update_commands
    @com.each {|sprite| sprite.update_sprites(@com_index,@active)}
  end      
  def update_particles
    return if @particles_bitmap == nil     
    @particles_bitmap.each {|sprite| sprite.update }
  end
end
#==============================================================================
# ■ Scene Title
#==============================================================================
class Scene_CharSellect
  def create_help_window
    @help_window = Window_Info.new
    @help_window.opacity = 0
    @help_window.y = Graphics.height - @help_window.height
  end
  def update
    update_command
    update_sprites
  end      
  def update_command
    update_key
    refresh_index if @com_index_old != @com_index
    @help_window.set_text(HB::INFO[@com_index])
  end        
  def update_key
    if Input.trigger?(:RIGHT)
      add_index(1) 
    elsif Input.trigger?(:LEFT)
      add_index(-1)
    elsif Input.trigger?(:C)  
      select_command
    elsif Input.trigger?(:B)  
      cancel_command
    end
  end          
  def select_command
    case @com_index
      when 0; actor_1
      when 1; actor_2
    end
  end
  def add_index(value = 0)
    @com_index += value
    @com_index = 0 if @com_index > @com_index_max
    @com_index = @com_index_max if @com_index < 0
  end        
  def refresh_index
    @com_index_old = @com_index
    Sound.play_cursor
  end
  def cancel_command
    Sound.play_cancel
    SceneManager.return
  end
  def actor_1
    Sound.play_ok
    DataManager.setup_new_game
    fadeout_all
    $game_party.add_actor(HB::CHARID[0])
    $game_map.autoplay
    SceneManager.goto(Scene_Map)
  end           
  def actor_2
    Sound.play_ok
    DataManager.setup_new_game
    fadeout_all
    $game_party.add_actor(HB::CHARID[1])
    $game_map.autoplay
    SceneManager.goto(Scene_Map)
  end
  
  def play_title_music
    Audio.bgm_play("Audio/BGM/" + HB::BGM, 100, 100)
    RPG::BGS.stop
    RPG::ME.stop
  end  
  def fadeout_all(time = 1000)
    RPG::BGM.fade(time)
    RPG::BGS.fade(time)
    RPG::ME.fade(time)
    Graphics.fadeout(time * Graphics.frame_rate / 1000)
    RPG::BGM.stop
    RPG::BGS.stop
    RPG::ME.stop
  end
end
class Window_Info < Window_Base
  def initialize(line_number = HB::LINE)
    super(0, 0, Graphics.width, fitting_height(line_number))
  end
  def set_text(text)
    if text != @text
      @text = text
      refresh
    end
  end
  def clear
    set_text("")
  end
  def refresh
    contents.clear
    draw_text_ex(0, 0, @text)
  end
end 
 
Социальные закладки