[Script] [ACE] [Title] "Are You Sure" - New Game Title

sanggameboysanggameboy Posts: 1,943Registered
[align=center][size=xx-large]"Are You Sure" - New Game Title[/size]
Sanggameboy
[/align]

[chapter]Giới thiệu[/chapter]
Bạn đã bao giờ chơi qua các dạng game quản lý thời gian như Dinner Dash hay Cake Mania chưa nhỉ? Nếu chơi rồi, thì chắc bạn cũng biết rằng sau lần chơi thứ 2, nếu bạn chọn "New Game (chơi lại từ đầu)" thì game sẽ hiện ra hai sự lựa chọn. Hai sự lựa chọn đó có dạng như "Bạn có chắc chắn rằng bạn muốn chơi lại từ đâu? (Yes, no)". Vậy nếu bạn đang làm một dạng mini game quản lý thời gian, thì tại sao bạn lại không sử dụng chức năng này nhỉ?

[chapter]Screenshots[/chapter]

[align=center]nfyq.png
[/align]

[chapter]SCRIPT[/chapter]

#==============================================================================
# ** "Are You Sure" New Game Title
#------------------------------------------------------------------------------
#========================================================================
# Script by Sanggameboy, edited by Death (Nam). 
# Credit Sanggameboy, Enterbrain and Death if you use this script. Thank you.
# Special thanks to William TheUnproPro and DiamondandPlatinum3.
#========================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    SceneManager.clear
    Graphics.freeze
    create_background
    create_foreground
    create_command_window
    play_title_music
  end
  #--------------------------------------------------------------------------
  # * Get Transition Speed
  #--------------------------------------------------------------------------
  def transition_speed
    return 20
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    SceneManager.snapshot_for_background
    dispose_background
    dispose_foreground
  end
  #--------------------------------------------------------------------------
  # * Create Background
  #--------------------------------------------------------------------------
  def create_background
    @sprite1 = Sprite.new
    @sprite1.bitmap = Cache.title1($data_system.title1_name)
    @sprite2 = Sprite.new
    @sprite2.bitmap = Cache.title2($data_system.title2_name)
    center_sprite(@sprite1)
    center_sprite(@sprite2)
  end
  #--------------------------------------------------------------------------
  # * Create Foreground
  #--------------------------------------------------------------------------
  def create_foreground
    @foreground_sprite = Sprite.new
    @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    @foreground_sprite.z = 100
    draw_game_title if $data_system.opt_draw_title
  end
  #--------------------------------------------------------------------------
  # * Draw Game Title
  #--------------------------------------------------------------------------
  def draw_game_title
    @foreground_sprite.bitmap.font.size = 48
    rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
    @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
  end
  #--------------------------------------------------------------------------
  # * Free Background
  #--------------------------------------------------------------------------
  def dispose_background
    @sprite1.bitmap.dispose
    @sprite1.dispose
    @sprite2.bitmap.dispose
    @sprite2.dispose
  end
  #--------------------------------------------------------------------------
  # * Free Foreground
  #--------------------------------------------------------------------------
  def dispose_foreground
    @foreground_sprite.bitmap.dispose
    @foreground_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Move Sprite to Screen Center
  #--------------------------------------------------------------------------
  def center_sprite(sprite)
    sprite.ox = sprite.bitmap.width / 2
    sprite.oy = sprite.bitmap.height / 2
    sprite.x = Graphics.width / 2
    sprite.y = Graphics.height / 2
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_TitleCommand.new
    @command_window.set_handler(:new_game, method(:command_new_game))
    @command_window.set_handler(:continue, method(:command_continue))
    @command_window.set_handler(:shutdown, method(:command_shutdown))
  end
  #--------------------------------------------------------------------------
  # * Close Command Window
  #--------------------------------------------------------------------------
  def close_command_window
    @command_window.close
    update until @command_window.close?
  end
  #--------------------------------------------------------------------------
  # * [New Game] Command (CHANGED)
  #--------------------------------------------------------------------------
  def command_new_game
    if FileTest.exist?("Save01.rvdata2")
        Audio.se_play("/Audio/SE/Chest", 90, 150) 
        SceneManager.call(AYS)
      else
        DataManager.setup_new_game
        close_command_window
        fadeout_all
        $game_map.autoplay
        SceneManager.goto(Scene_Map)  
  end
  end
  #--------------------------------------------------------------------------
  # * [Continue] Command (CHANGED)
  #--------------------------------------------------------------------------
  def command_continue
    close_command_window
    DataManager.load_game(0)
    fadeout_all
    $game_system.on_after_load
    SceneManager.goto(Scene_Map)
    #SceneManager.call(Scene_Load)
  end
  #--------------------------------------------------------------------------
  # * [Shut Down] Command
  #--------------------------------------------------------------------------
  def command_shutdown
    close_command_window
    fadeout_all
    SceneManager.exit
  end
  #--------------------------------------------------------------------------
  # * Play Title Screen Music
  #--------------------------------------------------------------------------
  def play_title_music
    $data_system.title_bgm.play
    RPG::BGS.stop
    RPG::ME.stop
  end
end
   #--------------------------------------------------------------------------
class AYS < Scene_MenuBase
  
  def start
    super
    create_command_window
    @window = AST.new
  end
  
  def create_command_window
    @command_window = AYSS.new
    @command_window.set_handler(:new,      method(:stillnewgame))
    @command_window.set_handler(:continue2, method(:continue2))
  end
  
  def stillnewgame
    DataManager.setup_new_game
    fadeout_all
    $game_map.autoplay
    SceneManager.goto(Scene_Map)
  end
  
  def continue2
    DataManager.load_game(0)
    fadeout_all
    $game_system.on_after_load
    SceneManager.goto(Scene_Map)
  end
  
end

#========================================================================
class AYSS < Window_Command
  
  def initialize
    super((544-window_width)/2, 210)
    end

  def make_command_list
    main
  end
  
  def window_width
    return 160
  end
  
  def main
    add_command("Chơi lại từ đầu", :new)
    add_command("Chơi tiếp", :continue2)
  end
end
#========================================================================
class AST < Window_Base
  def initialize
    super((544-403)/2, 160, 403, 24+12*2)
    text
    end
  
  def text
    draw_text(0, 0, 403-12*2, 24,"Bạn đang chơi dở game ở lần trước, bạn có muốn chơi lại từ đầu?",1)
#draw_text(x, y, text_width, text_height, text, alignment)
  end
    end

[chapter]DEMO[/chapter]
Cho ai lười copy and paste
Mega.co.nz - Bác Kim Béo

[chapter]Credit[/chapter]
Sanggameboy, Enterbrain, Death.
(Trong Demo, mình quên viết Enterbrain, các bạn nhớ đừng bỏ sót)

[chapter]Điều khoản sử dụng[/chapter]
Miễn phí, kèm theo credit đầy đủ.

Comments

Sign In or Register to comment.