class Scene_PinBall < Scene_Base
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
#~     create_background

    @pinball= PinBall.new(80.0 , 200.0 , 2.0 , -8.0)
    create_ball
    @actor = $game_party.menu_actor
    
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_ball
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    @pinball.update
    @ball_sprite.update
    goto_title if Input.trigger?(:B)
  end

  #--------------------------------------------------------------------------
  # ● 背景の作成
  #--------------------------------------------------------------------------
  def create_background
    @background_sprite = Sprite.new
    @background_sprite.bitmap = SceneManager.background_bitmap
    @background_sprite.color.set(16, 16, 16, 128)
  end
  #--------------------------------------------------------------------------
  # ● 背景の解放
  #--------------------------------------------------------------------------
  def dispose_background
    @background_sprite.dispose
  end  
  #--------------------------------------------------------------------------
  # ● ボールの作成
  #--------------------------------------------------------------------------  
  def create_ball
    @ball_sprite = Sprite_PinBall.new(@viewport,"Actor2.png" , 1 , @pinball)
  end  
  #--------------------------------------------------------------------------
  # ● ボールの解放
  #--------------------------------------------------------------------------
  def dispose_ball
    @ball_sprite.dispose
  end    
  #--------------------------------------------------------------------------
  # ● キャラクターのビットマップを設定
  #--------------------------------------------------------------------------
  def set_character_bitmap
    self.bitmap = Cache.character(@character_name)
    sign = @character_name[/^[\!\$]./]
    if sign && sign.include?('$')
      @cw = bitmap.width / 3
      @ch = bitmap.height / 4
    else
      @cw = bitmap.width / 12
      @ch = bitmap.height / 8
    end
    self.ox = @cw / 2
    self.oy = @ch
  end 
  #--------------------------------------------------------------------------
  # ● タイトル画面へ遷移
  #--------------------------------------------------------------------------
  def goto_title
    fadeout_all
    SceneManager.goto(Scene_Title)
  end  
  
end
