Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- #** Quasi Pop Up [[ Snipet ]]
- #==============================================================================
- # Simple plug and play.
- # Makes pop up text with any text, location and duration.
- #
- # To use:
- # In the event, do the follow Script call:
- # pop_up(string, duration, x, y, color)
- # - string is the text you want to to pop up
- # - duration is how long it should last ( default is 60 )
- # - x, y are the location of where the text should pop at.
- # x and y are set in the center of the screen by default.
- # - color changes the color of the text, white by default.
- #
- # Example of popping a text on Event 2:
- # Script Call:
- # string = "test"
- # x = $game_map.events[2].screen_x
- # y = $game_map.events[2].screen_y
- # color = Color.new(255,0,0,255)
- # pop_up(string,60,x,y,color)
- #
- #==============================================================================#
- # By Quasi (http://quasixi.wordpress.com/)
- # - 8/25/14
- #==============================================================================#
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # This class performs the map screen processing.
- #==============================================================================
- class Scene_Map < Scene_Base
- alias qpop_update update
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- qpop_update
- update_pop if @pop_dur
- end
- #--------------------------------------------------------------------------
- # * Update Pop up
- #--------------------------------------------------------------------------
- def update_pop
- return unless @pop
- zv = 1.0/(@pop_dur/4)
- @pop.zoom_y += zv if @pop.zoom_y < 1
- @pop_dur -= 1
- @pop.dispose if @pop_dur <= 0
- @pop_dur = nil if @pop_dur <= 0
- end
- #--------------------------------------------------------------------------
- # * Initiate Pop up
- #--------------------------------------------------------------------------
- def pop_up(string, duration, x, y, color)
- color = Color.new(255,255,255,255) if color.nil?
- @pop = Sprite.new
- @pop.x = x - 100
- @pop.y = y - 15
- @pop.bitmap = Bitmap.new(200,30)
- # rmvxa default fonts, but you can change to what you want
- @pop.bitmap.font.name = ["Verdana", "Arial", "Courier New"]
- @pop.bitmap.font.color = color
- @pop.bitmap.draw_text(@pop.bitmap.rect, string, 1)
- @pop_dur = duration
- @pop.zoom_y = 0
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #------------------------------------------------------------------------------
- # An interpreter for executing event commands. This class is used within the
- # Game_Map, Game_Troop, and Game_Event classes.
- #==============================================================================
- class Game_Interpreter
- def pop_up(string, duration=60, x=Graphics.width/2, y=Graphics.height/2, color=nil)
- return unless SceneManager.scene_is?(Scene_Map)
- SceneManager.scene.pop_up(string, duration, x, y,color)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement