Sistema de mensagem por "balão"

5 Respostas   464 Visualizações

0 Membros e 1 Visitante estão vendo este tópico.

MambaNegra

  • *
  • Posts: 59
  • Ouros: 32
Tópico criado em: 28/06/2015 às 23:47 - Última modificação por ofkings em 29/06/2015 às 19:45

Eu preciso de um sistema de mensagem no estilo "balão"

algo no estilo Tales of Vesperia:
https://youtu.be/ZWzWeSKMYo0

achei um do msm criador do SBS tankentai, mas é pra VX e esta em japones, alguem tem ou pode fazer algo similar?

Video:
https://www.youtube.com/watch?v=eKunv693YO4&feature=youtu.be



Site do jogo:
http://rpgex.sakura.ne.jp/home/game/index.php
Download:
http://www.mediafire.com/download/n1ah46549w51252/princessANDknight.rar
[/b]

Geraldo de Rívia

  • Mito
  • *
  • Posts: 4452
  • Ouros: 3887
  • O vento está sibilando.
  • Medalhas Vencedor do Protótipo Premiado Participantes do Maps Together 2
Resposta 1: 29/06/2015 às 08:33

Seria algo tipo esse?

MambaNegra

  • *
  • Posts: 59
  • Ouros: 32
Resposta 2: 29/06/2015 às 18:47

eu tinha testado esse, é algo do tipo, só que ao invés de usar a window skin eu queria usar imagens, igual o script do jogo que postei, se abrir a pasta do jogo vai ver que tem varios arquivos de "chat" tipo esse:
Spoiler
[close]

Esse aki é o dialogo do meu jogo feito por eventos, eu queria fazer algo parecido no "in-game"
Spoiler
[close]

fiz um no photoshop:
Spoiler
[close]


Raizen

  • Administrador
  • *
  • Posts: 3224
  • Ouros: 3192
  • Medalhas Vencedor do Protótipo Premiado Participante notável do evento "A Estação das Luzes do Norte" Vencedor CRM Awards - Melhor Scripter Vencedores das edições do Concurso Projeto Rickas!
Resposta 3: 30/06/2015 às 00:31

Peguei a ideia x)... Bom acho que você quer tirar a windowskin e usar imagens, se eu simplesmente tirar a opacidade da window... sabe deixar o fundo invisível, isso seria o suficiente para você fazer o resto por eventos?

MambaNegra

  • *
  • Posts: 59
  • Ouros: 32
Resposta 4: 30/06/2015 às 20:17

Bom, por eventos acho que até da mas ai até aqueles npc aleatorios que não tem importancia no jogo eu teria que criar esses eventos

se tivesse como converter o script do VX,  esse aki:


Window_Message
Código: [Selecionar]
#==============================================================================
# ■ Game_Temp
#------------------------------------------------------------------------------
#  セーブデータに含まれない、一時的なデータを扱うクラスです。
#==============================================================================
class Game_Temp
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数 $game_temp.battle_event_first
  #--------------------------------------------------------------------------
  attr_accessor :event_id                 # 現在動作中のイベントID
  attr_accessor :select_space             # 選択肢のカーソル位置
  attr_accessor :select_cut               # 選択肢ウエイト省略
  attr_accessor :snapshot                 # スナップショット
  attr_accessor :snapshot_off             # スナップショット消去
  attr_accessor :battler_message          # 戦闘中セリフ
  attr_accessor :battle_back              # 戦闘背景
  attr_accessor :route_cancel             # 移動時のウエイトスタート
  attr_accessor :route_wait               # 移動時のウエイト
  attr_accessor :last_battle_end          # ラストバトル勝利
  attr_accessor :lily_window              # 百合ウインドウ表示
  attr_accessor :battle_event_first       # 最速でバトルイベント実行
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_n02 initialize
  def initialize
    initialize_n02
    @event_id = 0
    @select_space = 0
    @select_cut = false
    @snapshot = false
    @snapshot_off = false
    @battler_message = false
    @battle_back = 1
    @route_cancel = false
    @route_wait = false
    @last_battle_end = false
    @lily_window = false
    @battle_event_first = false
  end
end 
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
#  システム周りのデータを扱うクラスです。 $game_system.circle
#==============================================================================
class Game_System
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :walk_speed               # 歩行スピード
  attr_accessor :message_display          # メッセージ表示タイプ
  attr_accessor :battler_speed            # 戦闘スピード
  attr_accessor :command_remain           # コマンド位置記憶
  attr_accessor :item_remain              # スキルやアイテムの位置記憶
  attr_accessor :command_battle_index     # 記憶した戦闘コマンド位置
  attr_accessor :command_menu_index       # 記憶したメニューコマンド位置
  attr_accessor :skill_menu_index         # 記憶したメニュースキル位置
  attr_accessor :weapon_flash             # 武器技閃き
  attr_accessor :remain_action            # 記憶している行動
  attr_accessor :menu_window              # メニューウインドウのタイプ
  attr_accessor :circle                   # マップの暗幕ファイル名
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_n02 initialize
  def initialize
    initialize_n02
    @walk_speed = 2
    @message_display = 1
    @battler_speed = 2
    @command_remain = true
    @item_remain = true
    @skill_menu_index = 0
    @command_battle_index = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
    @command_menu_index = 0
    @weapon_flash = []
    @remain_action = []
    @menu_window = false
    @circle = ""
  end
end 
#==============================================================================
# ■ Game_Event
#------------------------------------------------------------------------------
#  イベントを扱うクラスです。
#==============================================================================
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # ● イベント起動
  #--------------------------------------------------------------------------
  def start
    # メッセージ座標取得のため、イベントIDをチェック 
    $game_temp.event_id = @id
    return if @list.size <= 1                   # 実行内容が空?
    @starting = true
    $game_temp.route_wait = false
    $game_temp.route_cancel = false
    lock if @trigger < 3
    unless $game_map.interpreter.running?
      $game_map.interpreter.setup_starting_event
    end
  end
end 
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  ゲーム中のすべてのウィンドウのスーパークラスです。
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 通常文字色の取得
  #--------------------------------------------------------------------------
  def normal_color
    return text_color(26)
  end
  #--------------------------------------------------------------------------
  # ● 影文字色の取得
  #--------------------------------------------------------------------------
  def shadow_color
    return text_color(25)
  end
  #--------------------------------------------------------------------------
  # ● 赤文字色の取得
  #--------------------------------------------------------------------------
  def red_color
    return text_color(28)
  end
  #--------------------------------------------------------------------------
  # ● 青文字色の取得
  #--------------------------------------------------------------------------
  def blue_color
    return text_color(9)
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画 ドロップシャドウ付き
  #--------------------------------------------------------------------------
  def draw_text_ds(x, y, cw, text, align = 0, enabled = true)
    self.contents.font.size = 20
    self.contents.font.shadow = false
    self.contents.font.color = shadow_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(x + 1, y + 1, cw, WLH, text, align)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(x, y, cw, WLH, text, align)
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画 サイズ指定
  #--------------------------------------------------------------------------
  def draw_text_free(x, y, cw, text, size, align = 0)
    self.contents.font.size = size
    self.contents.font.shadow = false
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, cw, WLH, text, align)
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画 サイズ指定
  #--------------------------------------------------------------------------
  def draw_text_big(x, y, cw, text, size, align = 0)
    self.contents.font.size = size
    self.contents.font.shadow = false
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, cw, 36, text, align)
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画 サイズ指定
  #--------------------------------------------------------------------------
  def draw_text_pinch(x, y, cw, text, size, align = 0)
    self.contents.font.size = size
    self.contents.font.shadow = false
    self.contents.font.color = red_color
    self.contents.draw_text(x, y, cw, WLH, text, align)
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画 ベーシックスタイル
  #--------------------------------------------------------------------------
  def draw_text_basic(x, y, cw, text, align = 0)
    self.contents.font.size = 16
    self.contents.font.shadow = false
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, cw, WLH, text, align)
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画 ベーシックスタイル
  #--------------------------------------------------------------------------
  def draw_text_basic_run(x, y, cw, text, align = 0)
    self.contents.font.size = 16
    self.contents.font.shadow = false
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = 128 if !$game_troop.can_escape
    self.contents.draw_text(x, y, cw, WLH, text, align)
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画 使用不可スタイル
  #--------------------------------------------------------------------------
  def draw_text_enabled(x, y, cw, text, align = 0)
    self.contents.font.size = 16
    self.contents.font.shadow = false
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = 128
    self.contents.draw_text(x, y, cw, WLH, text, align)
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画 パラメータアップ(赤文字)
  #--------------------------------------------------------------------------
  def draw_text_ds_up(x, y, cw, text, align = 0)
    text = "(+" + text.to_s + ")"
    self.contents.font.size = 12
    self.contents.font.shadow = false
    self.contents.font.color = red_color
    self.contents.draw_text(x, y, cw, WLH, text, align)
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画 パラメータダウン(青文字)
  #--------------------------------------------------------------------------
  def draw_text_ds_down(x, y, cw, text, align = 0)
    text = "(" + text.to_s + ")"
    self.contents.font.size = 12
    self.contents.font.shadow = false
    self.contents.font.color = blue_color
    self.contents.draw_text(x, y, cw, WLH, text, align)
  end
 
end 

#==============================================================================
# ■ Window_Selectable
#------------------------------------------------------------------------------
#  カーソルの移動やスクロールの機能を持つウィンドウクラスです。
#==============================================================================

class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :item_max                 # 項目数
  attr_reader   :column_max               # 桁数
  attr_reader   :index                    # カーソル位置
  attr_reader   :help_window              # ヘルプウィンドウ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, spacing = 32)
    @item_max = 1
    @column_max = 1
    @index = -1
    @spacing = spacing
    @adjust_x = -10
    @adjust_y = 10
    # カーソルスプライトを作成
    @cursor = Sprite.new
    @cursor.bitmap = Cache.system("cursor")
    @cursor.src_rect.set(0, 0, 28, 22)
    @cursor.z = 3000
    @cursor_flame = 0
    @cursor.visible = false
    super(x, y, width, height)
  end
  #--------------------------------------------------------------------------
  # ● カーソルの更新
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0                   # カーソル位置が 0 未満の場合
      @cursor.visible = false if @cursor != nil
    else                            # カーソル位置が 0 以上の場合
      @cursor.visible = true if @cursor.visible == false && !@cursor_off
      @cursor.visible = false if !self.active
      @cursor_flame = 0 if @cursor_flame == 40
      @cursor.src_rect.set(0,  0, 24, 22) if @cursor_flame == 0
      @cursor.src_rect.set(0, 22, 24, 22) if @cursor_flame == 10
      @cursor.src_rect.set(0, 44, 24, 22) if @cursor_flame == 20
      @cursor.src_rect.set(0, 22, 24, 22) if @cursor_flame == 30
      @cursor_flame += 1
      @cursor.x = self.x + @adjust_x + index % @column_max * @spacing
      @cursor.y = self.y + @adjust_y + index / @column_max * WLH
    end
  end
  #--------------------------------------------------------------------------
  # ● カーソル消去
  #--------------------------------------------------------------------------
  def cursor_off
    @cursor.visible = false
    @cursor_off = true
  end
  #--------------------------------------------------------------------------
  # ● カーソルオン
  #--------------------------------------------------------------------------
  def cursor_on
    @cursor.visible = true
    @cursor_off = false
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    self.contents.dispose
    super
    @cursor.dispose if @cursor != nil
  end
end 
 
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
#  文章表示に使うメッセージウィンドウです。
#==============================================================================

class Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 定数
  #--------------------------------------------------------------------------
  MAX_LINE = 4                            # 最大行数
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 288, 534, 218)
    self.z = 200
    self.active = false
    self.index = -1
    self.opacity = 0
    @text = nil                 # 表示すべき残りの文章
    @contents_x = 0             # 次の文字を描画する X 座標
    @contents_y = 0             # 次の文字を描画する Y 座標
    @line_count = 0             # 現在までに描画した行数
    @wait_count = 0             # ウェイトカウント
    @background = 0             # 背景タイプ
    @position = 2               # 表示位置
    @show_fast = false          # 早送りフラグ
    @line_show_fast = false     # 行単位早送りフラグ
    @pause_skip = false         # 入力待ち省略フラグ
    @adjust_x = 0               # ウインドウ位置調整
    @adjust_y = 0               # ウインドウ位置調整
    @plus_x = 0                 # ウインドウ位置調整
    @plus_y = 0                 # ウインドウ位置調整
    @tail_plus_x = 0            # ウインドウ位置調整
    @tail_plus_y = 0            # ウインドウ位置調整
    @freeze_x = 0               # ウインドウ位置調整
    @freeze_y = 0               # ウインドウ位置調整
    @cursor.visible = false
    @fast = true if $game_system.message_display == 1
    $message_index = 0
    create_number_input_window
    create_back_sprite
    create_choices_sprite
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    super
    dispose_number_input_window
    dispose_back_sprite
    dispose_choices_sprite
    @skin.dispose if @skin != nil
    @tail_a.dispose if @tail_a != nil
    @tail_b.dispose if @tail_b != nil
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    cursor_off
    super
    update_number_input_window
    update_back_sprite
    update_show_fast
    update_coordinates
    update_choices_sprite if @choice_time > 0
    return if @choice_time > 0 && !$game_temp.select_cut
    if @wait_count > 0                    # 文章内ウェイト中
      @wait_count -= 1
    elsif self.pause                      # 文章送り待機中
      input_pause
    elsif self.active                     # 選択肢入力中
      input_choice
    elsif @number_input_window.visible    # 数値入力中
      input_number
    elsif @text != nil                    # 残りの文章が存在
      update_message                        # メッセージの更新
    elsif continue?                       # 続ける場合
      start_message                         # メッセージの開始
      $game_message.visible = true
    else                                  # 続けない場合
      $game_message.visible = false
      self.contents.clear
    end
  end
  #--------------------------------------------------------------------------
  # ● 数値入力ウィンドウの作成
  #--------------------------------------------------------------------------
  def create_number_input_window
    @number_input_window = Window_NumberInput.new
    @number_input_window.visible = false
  end
  #--------------------------------------------------------------------------
  # ● 背景スプライトの作成
  #--------------------------------------------------------------------------
  def create_back_sprite
    @back_sprite = Sprite.new
    @back_sprite.bitmap = Cache.system("MessageBack")
    @back_sprite.visible = (@background == 1)
    @back_sprite.z = 190
  end
  #--------------------------------------------------------------------------
  # ● 選択肢スプライトの作成
  #--------------------------------------------------------------------------
  def create_choices_sprite
    @choices01 = Sprite.new
    @choices01.bitmap = Cache.system("choices")
    @choices01.src_rect.set(0, 0, 150, 12)
    @choices02 = Sprite.new
    @choices02.bitmap = Cache.system("choices")
    @choices02.src_rect.set(0, 12, 150, 12)
    @choice_time = 0
    @choices01.ox = 75
    @choices02.ox = 75
    @choices01.z = 1000
    @choices02.z = 1000
    @choices01.visible = false
    @choices02.visible = false
  end
  #--------------------------------------------------------------------------
  # ● 数値入力ウィンドウの解放
  #--------------------------------------------------------------------------
  def dispose_number_input_window
    @number_input_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 背景スプライトの解放
  #--------------------------------------------------------------------------
  def dispose_back_sprite
    @back_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● 選択肢スプライトの解放
  #--------------------------------------------------------------------------
  def dispose_choices_sprite
    @choices01.dispose
    @choices02.dispose
  end
  #--------------------------------------------------------------------------
  # ● 数値入力ウィンドウの更新
  #--------------------------------------------------------------------------
  def update_number_input_window
    @number_input_window.update
  end
  #--------------------------------------------------------------------------
  # ● 背景スプライトの更新
  #--------------------------------------------------------------------------
  def update_back_sprite
    @back_sprite.visible = (@background == 1)
    @back_sprite.y = y - 16
    @back_sprite.update
  end
  #--------------------------------------------------------------------------
  # ● 選択肢スプライトの更新
  #--------------------------------------------------------------------------
  def update_choices_sprite
    @choices01.x += 30
    @choices02.x -= 30
    @choice_time -= 1
    return if @choice_time != 0
  end
  #--------------------------------------------------------------------------
  # ● 早送りフラグの更新
  #--------------------------------------------------------------------------
  def update_show_fast
    @wait_count -= 1 if @fast
    if self.pause
      @show_fast = false
    elsif Input.trigger?(Input::C) and @wait_count < 2
      @show_fast = true
    elsif not Input.press?(Input::C)
      @show_fast = false
    end
    if @show_fast and @wait_count > 0
      @wait_count -= 1
    end
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ位置の更新
  #--------------------------------------------------------------------------
  def update_coordinates
    return if @character == nil
    return if @skin == nil
    if $game_temp.in_battle
      cx = @character.position_x
      cy = @character.position_y
    else 
      cx = @character.screen_x
      cy = @character.screen_y
    end 
    if cx != @old_coordinates_x
      x = cx - @old_coordinates_x
      if @skin.x + x + @adjust_x < 60
        if @skin.x + x + @adjust_x > -32
          self.x += x
          @skin.x += x
        end 
      end     
      @tail_a.x += x
      @tail_b.x += x
      @old_coordinates_x = cx
    end
    if cy != @old_coordinates_y
      y = cy - @old_coordinates_y
      if @skin.y + y < 460
        if @skin.y + y > 0
          self.y += y
          @skin.y += y
        end 
      end 
      @tail_a.y += y
      @tail_b.y += y
      @old_coordinates_y = cy
    end
  end
  #--------------------------------------------------------------------------
  # ● イベント座標の取得
  #--------------------------------------------------------------------------
  def get_coordinates
    if $game_temp.in_battle
      case $message_index
      when -1  # -1の場合、主人公の座標を取得
        $message_index = 0
        return $game_party.members[0]
      when -2 
        $message_index = 0
        return $game_party.members[1]
      when -3 
        $message_index = 0
        return $game_party.members[2]
      end
      return $game_troop.members[$message_index]
    end 
    # マップにイベントが存在するか判定
    if $game_map.events != nil
      # パラメータで分岐
      case $message_index
      when -1  # -1の場合、主人公の座標を取得
        $message_index = 0
        return $game_player
      when 0  # 0(何もしない初期値)の場合、そのイベントの座標を取得
        events = $game_map.events
        return events == nil ? nil : events[$game_temp.event_id]
      else  # 特定のイベント
        events = $game_map.events
        return events == nil ? nil : events[$message_index]
      end
    # マップにイベントが存在しない場合、主人公座標を取得
    else
      return $game_player
    end
  end
  #--------------------------------------------------------------------------
  # ● 次のメッセージを続けて表示するべきか判定
  #--------------------------------------------------------------------------
  def continue?
    return true if $game_message.num_input_variable_id > 0
    return false if $game_message.texts.empty?
    if not $game_temp.in_battle
      return false if @background != $game_message.background
      #return false if @position != $game_message.position
    end
    return true
  end
  #--------------------------------------------------------------------------
  # ● メッセージの開始
  #--------------------------------------------------------------------------
  def start_message
    reset_window
    @text = ""
    @choice = @big = false
    @choice_adjust = 0
    for i in 0...$game_message.texts.size
      if i >= $game_message.choice_start
        @choice = true
      end
      @text += $game_message.texts[i].clone + "\x00"
      if self.contents.text_size($game_message.texts[i]).width > @m_width
        @m_width = self.contents.text_size($game_message.texts[i]).width
      end
    end
    @item_max = $game_message.choice_max
    convert_special_characters
    new_page
    make_skin
    adjust_skin
    if $game_temp.in_battle
      set_position_in_battle
    else
      set_position
    end 
    if @choice
      Audio.se_play("Audio/SE/Saint5", 70, 70)
      @choices01.x = @skin.x - 450 + @skin.width / 2
      @choices02.x = @skin.x + 450 + @skin.width / 2
      @choices01.y = self.y - 15
      @choices02.y = self.y - 3
      @choice_time = 15
      @choices01.visible = true
      @choices02.visible = true
    end
    @big = false
  end
  #--------------------------------------------------------------------------
  # ● スキンの微調整
  #--------------------------------------------------------------------------
  def adjust_skin
    case @position
    when 0  # 上
      file = "U"
      @tail_plus_x -= 8
      @tail_plus_y += 8
    when 1  # 中
      #self.y = 144
    when 2  # 下
      file = "D"
    end
    if @m_width < 100
      @tail_a.bitmap = Cache.system(file + "N_tail_a")
      @tail_b.bitmap = Cache.system(file + "N_tail_b")
      if @position == 0
        @tail_plus_x += 8
        @tail_plus_y -= 16
        @plus_y += 10
      end 
    elsif @m_width < 190 
      if @position == 0
        @plus_y += 12
      end
    elsif @m_width < 280 
      if @position == 0
        @plus_y += 12
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウの背景と位置の設定
  #--------------------------------------------------------------------------
  def reset_window
    create_contents
    @m_width = @adjust_x = @adjust_y = @plus_x = @plus_y = @freeze_x = @freeze_y = 0
    @line = $game_message.texts.size
    @background = $game_message.background
    @position = $game_message.position
    if @background == 0   # 通常ウィンドウ
    else                  # 背景を暗くする、透明にする
    end
    case @position
    when 0  # 上
      @adjust_y -= 22
      file = "U"
      @tail_plus_x = -84
      @tail_plus_y = -164
      @plus_y -= 240
      @tail_plus_y += 64
      @plus_y += 64
    when 1  # 中
      #self.y = 144
    when 2  # 下
      @adjust_y -= 22
      file = "D"
      @tail_plus_x = -84
      @tail_plus_y = -70
      @plus_y += 64
      @tail_plus_y += 64
    end
    @tail_a.dispose if @tail_a != nil
    @tail_b.dispose if @tail_b != nil
    @tail_a = Sprite.new
    @tail_b = Sprite.new
    @tail_a.bitmap = Cache.system(file + "_tail_a")
    @tail_b.bitmap = Cache.system(file + "_tail_b")
    @tail_a.z = 120
    @tail_b.z = 100
  end
  #--------------------------------------------------------------------------
  # ● 表示位置決定
  #--------------------------------------------------------------------------
  def set_position
    @character = get_coordinates
    @old_coordinates_x = @character.screen_x
    @old_coordinates_y = @character.screen_y
    @adjust_x = -@m_width / 2 - 24
    self.x = @character.screen_x + @adjust_x + @plus_x
    self.y = @character.screen_y + @adjust_y + @plus_y
    if self.x < 64
      @freeze_x = 64 - self.x
      self.x += @freeze_x
      @tail_a.mirror = true
      @tail_b.mirror = true
      @tail_plus_x += 96
      if @m_width < 100
        file = "U"
        file = "D" if @position == 2
        @tail_a.bitmap = Cache.system(file + "_tail_a")
        @tail_b.bitmap = Cache.system(file + "_tail_b")
        @tail_plus_x -= 5 if @position == 0
        @tail_plus_y += 20 if @position == 0
      end
    elsif self.x > 450 - @m_width
      @freeze_x = 450 - @m_width - self.x
      self.x += @freeze_x
      if @m_width < 100
        file = "U"
        file = "D" if @position == 2
        @tail_a.bitmap = Cache.system(file + "_tail_a")
        @tail_b.bitmap = Cache.system(file + "_tail_b")
        @tail_plus_x -= 5 if @position == 0
        @tail_plus_y += 20 if @position == 0
      end
    end 
    @skin.x = @character.screen_x - 244 + @plus_x + @freeze_x
    @skin.y = @character.screen_y - 50 + @plus_y
    @tail_a.x = @character.screen_x + @tail_plus_x
    @tail_a.y = @character.screen_y + @tail_plus_y
    @tail_b.x = @character.screen_x + @tail_plus_x
    @tail_b.y = @character.screen_y + @tail_plus_y
  end
  #--------------------------------------------------------------------------
  # ● 表示位置決定
  #--------------------------------------------------------------------------
  def set_position_in_battle
    @character = get_coordinates
    @old_coordinates_x = @character.position_x
    @old_coordinates_y = @character.position_y
    @adjust_x = -@m_width / 2 - 24
    if $game_temp.in_battle
      @plus_y -= 32
      @tail_plus_y -= 32
      if @character.name == "マウンテンスライム"
        @plus_y += 36
        @tail_plus_y += 36
      end 
    end
    self.x = @character.position_x + @adjust_x + @plus_x
    self.y = @character.position_y + @adjust_y + @plus_y
    if self.x < 64
      @freeze_x = 64 - self.x
      self.x += @freeze_x
      @tail_a.mirror = true
      @tail_b.mirror = true
      @tail_plus_x += 96
      if @m_width < 100
        file = "U"
        file = "D" if @position == 2
        @tail_a.bitmap = Cache.system(file + "_tail_a")
        @tail_b.bitmap = Cache.system(file + "_tail_b")
        @tail_plus_x -= 5 if @position == 0
        @tail_plus_y += 20 if @position == 0
      end
    elsif self.x > 450 - @m_width
      @freeze_x = 450 - @m_width - self.x
      self.x += @freeze_x
      if @m_width < 100
        file = "U"
        file = "D" if @position == 2
        @tail_a.bitmap = Cache.system(file + "_tail_a")
        @tail_b.bitmap = Cache.system(file + "_tail_b")
        @tail_plus_x -= 5 if @position == 0
        @tail_plus_y += 20 if @position == 0
      end
    end 
    @skin.x = @character.position_x - 244 + @plus_x + @freeze_x
    @skin.y = @character.position_y - 50 + @plus_y
    @tail_a.x = @character.position_x + @tail_plus_x
    @tail_a.y = @character.position_y + @tail_plus_y
    @tail_b.x = @character.position_x + @tail_plus_x
    @tail_b.y = @character.position_y + @tail_plus_y
  end
  #--------------------------------------------------------------------------
  # ● ふきだしスキン作成
  #--------------------------------------------------------------------------
  def make_skin
    file = ""
    if @position == 0
      if @line == 1
        file += "N1-"
        @adjust_y += 74
        @plus_y += 16
      elsif @line == 2
        file += "N2-"
        @adjust_y += 48
        @plus_y += 4
      elsif @line == 3
        file += "N3-"
        @adjust_y += 22
        @plus_y += 12
      else
        file += "N4-"
        @plus_y += 12
      end
    elsif @position == 2
      if @line == 1
        file += "N1-"
        @adjust_y += 74
        @plus_y -= 86
      elsif @line == 2
        file += "N2-"
        @adjust_y += 48
        @plus_y -= 58
      elsif @line == 3
        file += "N3-"
        @adjust_y += 22
        @plus_y -= 32
      else
        file += "N4-"
      end
    end 
    if @m_width < 100
      file += "5"
    elsif @m_width < 190
      file += "10"
    elsif @m_width < 280
      file += "15"
    else
      file += "20"
    end
    @skin.dispose if @skin != nil
    @skin = Sprite.new
    @skin.bitmap = Cache.system(file)
    @skin.z = 110
  end
  #--------------------------------------------------------------------------
  # ● 改ページ処理
  #--------------------------------------------------------------------------
  def new_page
    contents.clear
    if $game_message.face_name.empty?
      @contents_x = 0
    else
      name = $game_message.face_name
      index = $game_message.face_index
      draw_face(name, index, 0, 0)
      @contents_x = 112
    end
    @contents_y = 0
    @line_count = 0
    @show_fast = false
    @line_show_fast = false
    @pause_skip = false
  end
  #--------------------------------------------------------------------------
  # ● 改行処理
  #--------------------------------------------------------------------------
  def new_line
    if @choice_adjust != 0
      @contents_x = @choice_adjust
    elsif @choice && $game_message.choice_start != 0
      c_width = 0
      text = @text.dup
      loop do
        c = text.slice!(/./m)            # 次の文字を取得
        case c
        when nil                          # 描画すべき文字がない
          break
        when "\x00"                       # 改行
          break
        end
        c_width += contents.text_size(c).width
      end
      @contents_x = @contents_x / 2 - c_width / 2
      @choice_adjust = @contents_x
    else
      @contents_x = 0
      @contents_x = 112 if !$game_message.face_name.empty?
    end
    @contents_y += WLH
    @line_count += 1
    @line_show_fast = false
  end
  #--------------------------------------------------------------------------
  # ● 特殊文字の変換
  #--------------------------------------------------------------------------
  def convert_special_characters
    @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    @text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
    @text.gsub!(/\\L\[([0-9]+)\]/i) { $game_actors[$1.to_i].level.to_s }
    @text.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
    @text.gsub!(/\\G/)              { "\x02" }
    @text.gsub!(/\\\./)             { "\x03" }
    @text.gsub!(/\\\|/)             { "\x04" }
    @text.gsub!(/\\!/)              { "\x05" }
    @text.gsub!(/\\>/)              { "\x06" }
    @text.gsub!(/\\</)              { "\x07" }
    @text.gsub!(/\\\^/)             { "\x08" }
    @text.gsub!(/\\B/)              { "\x09" }
    @text.gsub!(/\\\\/)             { "\\" }
  end
  #--------------------------------------------------------------------------
  # ● メッセージの終了
  #--------------------------------------------------------------------------
  def terminate_message
    self.contents.clear
    @choices01.visible = false
    @choices02.visible = false
    $game_temp.select_space = 0
    $game_temp.select_cut = false
    self.active = false
    self.pause = false
    self.index = -1
    @number_input_window.active = false
    @number_input_window.visible = false
    $game_message.main_proc.call if $game_message.main_proc != nil
    $game_message.clear
    @skin.dispose if @skin != nil
    @tail_a.dispose if @tail_a != nil
    @tail_b.dispose if @tail_b != nil
    @skin = nil
    @tail_a = nil
    @tail_b = nil
  end
  #--------------------------------------------------------------------------
  # ● メッセージの更新
  #--------------------------------------------------------------------------
  def update_message
    loop do
      c = @text.slice!(/./m)            # 次の文字を取得
      case c
      when nil                          # 描画すべき文字がない
        finish_message                  # 更新終了
        @wait_count = 50 if @choice && !$game_temp.select_cut
        break
      when "\x00"                       # 改行
        new_line
        if @line_count >= MAX_LINE      # 行数が最大のとき
          unless @text.empty?           # さらに続きがあるなら
            self.pause = true           # 入力待ちを入れる
            break
          end
        end
      when "\x01"                       # \C[n]  (文字色変更)
        @text.sub!(/\[([0-9]+)\]/, "")
        contents.font.color = text_color($1.to_i)
        next
      when "\x02"                       # \G  (所持金表示)
        @gold_window.refresh
        @gold_window.open
      when "\x03"                       # \.  (ウェイト 1/4 秒)
        @wait_count = 15
        break
      when "\x04"                       # \|  (ウェイト 1 秒)
        @wait_count = 60
        break
      when "\x05"                       # \!  (入力待ち)
        self.pause = true
        break
      when "\x06"                       # \>  (瞬間表示 ON)
        @line_show_fast = true
      when "\x07"                       # \<  (瞬間表示 OFF)
        @line_show_fast = false
      when "\x08"                       # \^  (入力待ちなし)
        @pause_skip = true
      when "\x09"                       # サイズ変更
        if !@big
          @big = true
        else
          @big = false
        end
      else                              # 普通の文字
        if @big
          draw_text_big(@contents_x , @contents_y, 40, c, 36)
          c_width = contents.text_size(c).width - 2
          @contents_x += c_width
        else
          draw_text_ds(@contents_x , @contents_y, 40, c)
          c_width = contents.text_size(c).width
          @contents_x += c_width
        end
      end
      next if @fast && !@choice
      break unless @show_fast or @line_show_fast
    end
  end
  #--------------------------------------------------------------------------
  # ● カーソルの更新
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0                   # カーソル位置が 0 未満の場合
      @cursor.visible = false if @cursor != nil
    else                            # カーソル位置が 0 以上の場合
      @cursor.visible = true if @cursor.visible == false
      @cursor_flame = 0 if @cursor_flame == 40
      @cursor.src_rect.set(0,  0, 28, 22) if @cursor_flame == 0
      @cursor.src_rect.set(0, 22, 28, 22) if @cursor_flame == 10
      @cursor.src_rect.set(0, 44, 28, 22) if @cursor_flame == 20
      @cursor.src_rect.set(0, 22, 28, 22) if @cursor_flame == 30
      @cursor_flame += 1
      @cursor.x = self.x + index % @column_max * @spacing - 8 + @choice_adjust
      @cursor.y = self.y + index / @column_max * WLH + $game_message.choice_start * 24 + 16
    end
  end
  #--------------------------------------------------------------------------
  # ● メッセージの更新終了
  #--------------------------------------------------------------------------
  def finish_message
    if $game_message.choice_max > 0
      start_choice
    elsif $game_message.num_input_variable_id > 0
      start_number_input
    elsif @pause_skip
      terminate_message
    else
      self.pause = true
    end
    @wait_count = 10
    $message_index = 0
    @text = nil
  end
  #--------------------------------------------------------------------------
  # ● 選択肢の開始
  #--------------------------------------------------------------------------
  def start_choice
    self.active = true
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● 数値入力の開始
  #--------------------------------------------------------------------------
  def start_number_input
    digits_max = $game_message.num_input_digits_max
    number = $game_variables[$game_message.num_input_variable_id]
    @number_input_window.digits_max = digits_max
    @number_input_window.number = number
    if $game_message.face_name.empty?
      @number_input_window.x = x - 38
    else
      @number_input_window.x = x + 112
    end
    @number_input_window.y = y #+ @contents_y
    @number_input_window.active = true
    @number_input_window.visible = true
    @number_input_window.update
  end
  #--------------------------------------------------------------------------
  # ● 文章送りの入力処理
  #--------------------------------------------------------------------------
  def input_pause
    if Input.trigger?(Input::B) or Input.trigger?(Input::C)
      self.pause = false
      if @text != nil and not @text.empty?
        new_page if @line_count >= MAX_LINE
      else
        terminate_message
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 選択肢の入力処理
  #--------------------------------------------------------------------------
  def input_choice
    if Input.trigger?(Input::B)
      if $game_message.choice_cancel_type > 0
        Sound.play_cancel
        $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
        terminate_message
      end
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      $game_message.choice_proc.call(self.index)
      terminate_message
    end
  end
  #--------------------------------------------------------------------------
  # ● 数値入力の処理
  #--------------------------------------------------------------------------
  def input_number
    if Input.trigger?(Input::C)
      Sound.play_decision
      $game_variables[$game_message.num_input_variable_id] =
        @number_input_window.number
      $game_map.need_refresh = true
      terminate_message
    end
  end
end
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
#  タイトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    @command_window.update
    if Input.trigger?(Input::C)
      @command_window.cursor_off
      case @command_window.index
      when 0    # ニューゲーム
        command_new_game
      when 1    # コンティニュー
        command_continue
      when 2    # シャットダウン
        command_shutdown
      end
    end
  end
end

MambaNegra

  • *
  • Posts: 59
  • Ouros: 32
Resposta 5: 06/07/2015 às 00:45

BUMP!