Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # TheoAllen - Pause anywhere at anytime
- # Version : 1.0
- # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
- # (This script documentation is written in informal indonesian language)
- # =============================================================================
- ($imported ||= {})[:Theo_Pause] = true
- # =============================================================================
- # Change Logs:
- # -----------------------------------------------------------------------------
- # 2014.01.16 - Finished script
- # =============================================================================
- =begin
- Perkenalan :
- Script ini ngebikin kamu bisa ngepause dimana dan kapan saja
- Cara penggunaan :
- Pasang script ini di bawah material namun di atas main
- Edit konfignya jika dirasa perlu
- Terms of Use :
- Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
- keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
- dipake buat komersil, jangan lupa, gw dibagi gratisannya.
- =end
- # =============================================================================
- # Konfigurasi
- # =============================================================================
- module Theo
- module Pause
- # --------------------------------------------------------------------------
- Color = Color.new(0,0,0,150)
- # Background color. Isi dengan format Color.new(red,green,blue,alpha)
- Text = "Pause"
- # Text yang ditampilkan saat pause
- # --------------------------------------------------------------------------
- FontName = ["Calibri"] # Font yang digunakan
- FontSize = 72 # Size font
- FontBold = true # Bold?
- FontItalic = true # Miring?
- # --------------------------------------------------------------------------
- DisplayPause = true # Tampilkan notifikasi pause?
- Button = :ALT # Tombol untuk melakukan pause
- # --------------------------------------------------------------------------
- end
- end
- # =============================================================================
- # Akhir dari konfigurasi
- # =============================================================================
- class Sprite_Screen < Sprite
- def initialize(viewport = nil)
- super(viewport)
- self.bitmap = Bitmap.new(Graphics.width,Graphics.height)
- end
- def dispose
- self.bitmap.dispose
- super
- end
- end
- class Bitmap
- def entire_fill(color = Color.new(0,0,0,150))
- fill_rect(self.rect,color)
- end
- end
- class Scene_Base
- alias scene_start start
- def start
- scene_start
- @pause_viewport = Viewport.new
- @pause_viewport.z = 999
- @pause_sprite = Sprite_Screen.new
- @pause_sprite.viewport = @pause_viewport
- @pause_sprite.bitmap.entire_fill(Theo::Pause::Color)
- @pause_sprite.bitmap.font.name = Theo::Pause::FontName
- @pause_sprite.bitmap.font.size = Theo::Pause::FontSize
- @pause_sprite.bitmap.font.bold = Theo::Pause::FontBold
- @pause_sprite.bitmap.font.italic = Theo::Pause::FontItalic
- @pause_sprite.bitmap.draw_text(@pause_sprite.bitmap.rect,
- Theo::Pause::Text, 1)
- @pause_sprite.visible = false
- end
- alias pause_update update_basic
- def update_basic
- pause_update
- if Input.trigger?(Theo::Pause::Button)
- $pause_flag = true
- @pause_sprite.visible = true if Theo::Pause::DisplayPause
- @saved_framecount = Graphics.frame_count
- while $pause_flag
- update_for_pause
- end
- end
- end
- def update_for_pause
- Graphics.update
- Input.update
- if Input.trigger?(Theo::Pause::Button)
- $pause_flag = false
- Graphics.frame_count = @saved_framecount
- @pause_sprite.visible = false
- Input.update
- end
- end
- alias scene_terminate terminate
- def terminate
- scene_terminate
- @pause_viewport.dispose
- @pause_sprite.dispose
- end
- end
- $pause_flag = false
Advertisement
Add Comment
Please, Sign In to add comment