dsiver144

HK Animated Title v1

Sep 20th, 2013
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.00 KB | None | 0 0
  1. #==============================================================================
  2. #  Hanzo Kimura's Animated Title Screen    (Translated by BlueTyphlosion)
  3. #  Scripted Date: 02/24/09
  4. #  PLEASE CREDIT: Hanzo Kimura
  5. #  if Your going to use this script for your title
  6. #
  7. #  IMAGES USED(All in Graphics/System) Folder:
  8. #     "TitleBGLoop.jpg" - For Scrolling Upward Effect
  9. #     "TitleBGSprite.jpg" - For Horizantally Endless Scrolling
  10. #     "TitleCursor.png" - For the title cursor
  11. #     "TitleMenu01.png" - For the title Menu (First Menu Active)
  12. #     "TitleMenu02.png" - For the title Menu (Second Menu Active)
  13. #     "TitleMenu03.png" - For the title Menu (Third Menu Active)
  14. #     "TitleLogo.png" - For the Title Logo
  15. #     "TitleSpark01.png" - For the Title Spark
  16. #     "TitleSpark02.png" - For the Title Spark
  17. #     "TitleSymbol.png" - For the Title Symbol
  18. #     "TitleCursorStrike01.png" - For Title Cursor Strike Effect(Left)
  19. #     "TitleCursorStrike02.png" - For Title Cursor Strike Effect(Right)
  20. #   **"TitleBG.jpg" - For Still Version Title Background
  21. #
  22. #  UPDATE #1
  23. #  ***New Function Added '$STILL_BG' Let's you control the Background behavior
  24. #     Set it to True if you want the Animated Waving Effect,
  25. #     Set it to False if you want a Still Background
  26. #  ***640x480 Version Added
  27. #
  28. #  IF YOU FIND ANY BUGS REPORT HERE:
  29. #  http://www.rpgmakervx.net/index.php?showtopic=16133&st=60
  30. #
  31. #==============================================================================
  32. #NEW FUNCTION
  33. $STILL_BG = false       # true=Still Background false=Animated Background
  34.                         #'TitleBG' is the filename that will be used for Still BG
  35.  
  36. $TITLE_MENU_X = 184     # Your Title Menu X Position
  37. $TITLE_MENU_Y = 260     # Your Title Menu Y Position
  38. $LOGO_X = 0             # Your Logo X Position
  39. $LOGO_Y = 0             # Your Logo Y Position
  40. $SPARK_COUNT = 350      # SPARK COUNT: Frames Before the Spark Appears again
  41. $SPARK_SPEED = 10       # The Speed of the Sparks
  42. $MENU_NEW = 260         # THE Y Position of the Cursor if NEW GAME
  43. $MENU_CONTINUE = 305    # THE Y Position of the Cursor if CONTINUE
  44. $MENU_EXIT = 345           # THE Y Position of the Cursor if EXIT
  45. $SYMBOL_SPEED = 1
  46.  
  47.  
  48. #DONT EDIT BELOW
  49. $titleloop = 1
  50. $SYMBOL_RESET = false
  51. #------------------------------------------------------------------------------
  52. #  This class performs the title screen processing.
  53. #==============================================================================
  54. class Scene_Title < Scene_Base
  55.   def start
  56.     super
  57.     SceneManager.clear
  58.     Graphics.freeze
  59.     create_command_window
  60.     create_title_background
  61.     play_title_music
  62.   end
  63.   alias create_command_window_hk create_command_window
  64.   def create_command_window
  65.     create_command_window_hk
  66.     @command_window.visible = false
  67.   end
  68.   def update
  69.     super
  70.     if $STILL_BG == false
  71.      @wave.update
  72.     if @sprite.oy != 0
  73.       @sprite.oy -= 1
  74.     elsif @sprite.oy == 0
  75.       @sprite.ox += 1
  76.     end
  77.     if @wave.oy != 0
  78.       @wave.oy -= 1
  79.     elsif @wave.oy == 0
  80.       if $TITLE_LOOP == 1 && @wave.ox != 1289
  81.         @wave.ox += 1
  82.       else
  83.         $TITLE_LOOP == 2
  84.       end
  85.       if $TITLE_LOOP == 2 && @wave.ox != -1189
  86.         @wave.ox -= 1
  87.       else
  88.         $TITLE_LOOP == 1
  89.       end
  90.     end
  91.    end
  92.      @symbol.ox -= $SYMBOL_SPEED
  93.      if $SYMBOL_RESET == true && @symbol.opacity == 0
  94.           $SYMBOL_RESET = false
  95.         elsif @symbol.opacity != 255
  96.           @symbol.opacity += 3
  97.         end
  98.      #=======Spark Animation========
  99.      @spark01.x += $SPARK_SPEED
  100.      @spark02.x -= $SPARK_SPEED
  101.      if $SPARK_COUNT != 0
  102.        $SPARK_COUNT -= 1
  103.      else
  104.        $SPARK_COUNT = 350
  105.        @spark01.x = -172
  106.        @spark02.x = 544
  107.      end
  108.      if @spark01.opacity != 255
  109.        @spark01.opacity += 20
  110.        @spark02.opacity += 20
  111.      end
  112.     #=======Menu Animation=========
  113.     case @command_window.index
  114.       when 0
  115.         @spark01.y = $MENU_NEW - 20
  116.         @spark02.y = $MENU_NEW
  117.         @symbol.oy = $MENU_NEW + 183
  118.         @strike1.y = $MENU_NEW
  119.         @strike2.y = $MENU_NEW
  120.         if @menu01.opacity != 255
  121.           @menu01.opacity += 20
  122.           @menu02.opacity -= 20
  123.           @menu03.opacity -= 20
  124.         end
  125.         if @cursor.y != $TITLE_MENU_Y
  126.           @cursor.y -= 5
  127.           end
  128.       when 1
  129.         @spark01.y = $MENU_CONTINUE - 20
  130.         @spark02.y = $MENU_CONTINUE
  131.         @symbol.oy = $MENU_CONTINUE + 93
  132.         @strike1.y = $MENU_CONTINUE
  133.         @strike2.y = $MENU_CONTINUE
  134.         if @menu02.opacity != 255
  135.           @menu02.opacity += 20
  136.           @menu01.opacity -= 20
  137.           @menu03.opacity -= 20
  138.         end
  139.         if @cursor.y != $MENU_CONTINUE && @cursor.y < $MENU_CONTINUE
  140.           @cursor.y += 5
  141.           elsif @cursor.y != $MENU_CONTINUE && @cursor.y > $MENU_CONTINUE
  142.           @cursor.y -= 5
  143.           end
  144.       when 2
  145.         @spark01.y = $MENU_EXIT - 20
  146.         @spark02.y = $MENU_EXIT
  147.         @symbol.oy = $MENU_EXIT + 13
  148.         @strike1.y = $MENU_EXIT
  149.         @strike2.y = $MENU_EXIT
  150.         if @menu03.opacity != 255
  151.           @menu03.opacity += 20
  152.           @menu02.opacity -= 20
  153.           @menu01.opacity -= 20
  154.         end
  155.         if @cursor.y != $MENU_EXIT
  156.           @cursor.y += 5
  157.         end
  158.       end
  159.   if @strike1.x != 0
  160.     @strike1.x += 11
  161.   end
  162.   if @strike2.x != 212
  163.     @strike2.x -= 12
  164.   end
  165.       check_menu
  166.     if Input.trigger?(Input::C)
  167.       case @command_window.index
  168.       when 0    #New game
  169.         command_new_game
  170.       when 1    # Continue
  171.         command_continue
  172.       when 2    # Shutdown
  173.         command_shutdown
  174.       end
  175.     end
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # * Checking Current Menu
  179.   #--------------------------------------------------------------------------
  180.   def check_menu
  181.     if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  182.       $SPARK_COUNT = 350
  183.       @spark01.x = -172
  184.       @spark02.x = 544
  185.       @spark01.opacity -= 255
  186.       @spark02.opacity -= 255
  187.       @symbol.opacity -= 255
  188.       $SYMBOL_RESET = true
  189.     case @command_window.index
  190.       when 0
  191.         @spark01.y = 280
  192.         @spark02.y = 300
  193.         @symbol.oy = 403
  194.         @strike1.y = 300
  195.         @strike2.y = 300
  196.         @strike1.x = -330
  197.         @strike2.x = 584
  198.       when 1
  199.         @spark01.y = 325
  200.         @spark02.y = 345
  201.         @symbol.oy = 358
  202.         @strike1.y = 345
  203.         @strike2.y = 345
  204.         @strike1.x = -330
  205.         @strike2.x = 584
  206.       when 2
  207.         @spark01.y = 365
  208.         @spark02.y = 385
  209.         @symbol.oy = 317
  210.         @strike1.y = 385
  211.         @strike2.y = 385
  212.         @strike1.x = -330
  213.         @strike2.x = 584
  214.       end
  215.     end
  216.   end
  217.   def create_title_background
  218.     @viewport1 = Viewport.new(0, 0, 1288, 891)
  219.     @viewport2 = Viewport.new(0, 0, 824, 480)
  220.     @viewport2.z = 10
  221.     if $STILL_BG == false
  222.     @sprite = Plane.new(@viewport1)
  223.     @sprite.bitmap = Cache.system("TitleBGLoop")
  224.     @sprite.oy = 371
  225.     @sprite.ox = 100
  226.     @sprite.z = -100
  227.     @wave = Sprite.new(@viewport1)
  228.     @wave.bitmap = Cache.system("TitleBGSprite")
  229.     @wave.oy = 371
  230.     @wave.ox = 100
  231.     @wave.wave_amp = 50
  232.     @wave.wave_length = 440
  233.     @wave.wave_speed = 1250  
  234.     @wave.opacity = 125
  235.     @wave.z = 5
  236.   else
  237.     @sprite = Sprite.new
  238.     @sprite.bitmap = Cache.system("TitleBG")
  239.     @sprite.y = 0
  240.     @sprite.x = 0
  241.     @sprite.z = -100
  242.   end
  243.     @logo = Sprite.new
  244.     @logo.bitmap = Cache.system("TitleLogo")
  245.     @logo.x = $LOGO_X
  246.     @logo.y = $LOGO_Y
  247.     @logo.z = 10
  248.     @menu01 = Sprite.new
  249.     @menu01.bitmap = Cache.system("TitleMenu01")
  250.     @menu01.x = $TITLE_MENU_X
  251.     @menu01.y = $TITLE_MENU_Y
  252.     @menu02 = Sprite.new
  253.     @menu02.bitmap = Cache.system("TitleMenu02")
  254.     @menu02.x = $TITLE_MENU_X
  255.     @menu02.y = $TITLE_MENU_Y
  256.     @menu02.opacity = 0
  257.     @menu03 = Sprite.new
  258.     @menu03.bitmap = Cache.system("TitleMenu03")
  259.     @menu03.x = $TITLE_MENU_X
  260.     @menu03.y = $TITLE_MENU_Y
  261.     @menu03.opacity = 0
  262.     @cursor = Sprite.new
  263.     @cursor.bitmap = Cache.system("TitleCursor")
  264.     @cursor.x = $TITLE_MENU_X
  265.     @cursor.y = $TITLE_MENU_Y
  266.     @cursor.z = 12
  267.     @strike1 = Sprite.new
  268.     @strike1.bitmap = Cache.system("TitleCursorStrike01")
  269.     @strike1.x = 0
  270.     @strike1.y = 260
  271.     @strike1.z = 9
  272.     @strike2 = Sprite.new
  273.     @strike2.bitmap = Cache.system("TitleCursorStrike02")
  274.     @strike2.x = 212
  275.     @strike2.y = 260
  276.     @strike2.z = 9
  277.     @symbol = Plane.new(@viewport2)
  278.     @symbol.bitmap = Cache.system("TitleSymbol")
  279.     @symbol.oy = 443
  280.     @symbol.ox = 100
  281.     @spark01 = Sprite.new
  282.     @spark01.bitmap = Cache.system("TitleSpark01")
  283.     @spark01.y = 280
  284.     @spark01.x = -172
  285.     @spark01.z = 12
  286.     @spark02 = Sprite.new
  287.     @spark02.bitmap = Cache.system("TitleSpark02")
  288.     @spark02.y = 300
  289.     @spark02.x = 544
  290.     @spark02.z = 12
  291.     @menu01.z = @menu02.z = @menu03.z = 13
  292.     if @continue_enabled  
  293.       @menu01.opacity = 0
  294.       @menu02.opacity = 255
  295.       @cursor.y = 305
  296.       @strike1.y = 305
  297.       @strike2.y = 305
  298.       @symbol.oy = 398
  299.     end
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # * Dispose of Title Graphic
  303.   #--------------------------------------------------------------------------
  304.   def dispose_title_background
  305.     if $STILL_BG == false
  306.     @wave.dispose
  307.     @wave.bitmap.dispose
  308.   end
  309.     @sprite.dispose
  310.     @logo.dispose
  311.     @menu01.dispose
  312.     @menu02.dispose
  313.     @menu03.dispose
  314.     @cursor.dispose
  315.     @strike1.dispose
  316.     @strike2.dispose
  317.     @symbol.dispose
  318.     @spark01.dispose
  319.     @spark02.dispose
  320.     @logo.bitmap.dispose
  321.     @menu01.bitmap.dispose
  322.     @menu02.bitmap.dispose
  323.     @menu03.bitmap.dispose
  324.     @cursor.bitmap.dispose
  325.     @strike1.bitmap.dispose
  326.     @strike2.bitmap.dispose
  327.     @spark01.bitmap.dispose
  328.     @spark02.bitmap.dispose
  329.   end
  330.   def terminate
  331.     super
  332.     SceneManager.snapshot_for_background
  333.     dispose_title_background
  334.   end
  335. end
Advertisement
Add Comment
Please, Sign In to add comment