Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # • Picture Over Event
- #==============================================================================
- # Author: Dax
- # Version: 1.4
- # Site: www.dax-soft.weebly.com
- # Requirements: Dax Core
- #==============================================================================
- # • Desc:
- #------------------------------------------------------------------------------
- # You can put an picture above the head of a event. Leaving him stopped or
- # animated.
- #==============================================================================
- # • How to Use: In Call Scripts.
- #------------------------------------------------------------------------------
- # poe(id, name, animation, [x, y])
- # * id : Event ID.
- # * name : Filename of the image, must it be in folder Picture.
- # * animation : |true| for yes and |false| for no.
- # * x : Add pos X
- # * y : Add pos Y
- #==============================================================================
- Dax.register(:picture_over_event, "Dax", 1.4) {
- #==============================================================================
- # • Rpg::PoE
- #==============================================================================
- module PoE
- extend self
- #----------------------------------------------------------------------------
- # • Variável.
- #----------------------------------------------------------------------------
- @poe ||= []
- #----------------------------------------------------------------------------
- # • Criar.
- #----------------------------------------------------------------------------
- def draw(id, name, animation, add)
- return if @poe[id.__id__]
- @poe[id.__id__] = Sprite_PoE.new("P: #{name}", id, animation, add)
- end
- #----------------------------------------------------------------------------
- # • Renovar.
- #----------------------------------------------------------------------------
- def dispose
- return if @poe.is_a?(NilClass)
- @poe.each { |i| i.dispose unless i.nil? }
- end
- #----------------------------------------------------------------------------
- # • Atualizar.
- #----------------------------------------------------------------------------
- def update
- return if @poe.nil?
- @poe.each { |i| i.update unless i.nil? or i.disposed?}
- end
- end
- #==============================================================================
- # • Sprite.
- #==============================================================================
- class Sprite_PoE < Sprite
- #----------------------------------------------------------------------------
- # • Inicialização dos objetos.
- #----------------------------------------------------------------------------
- def initialize(name, id, animation, add)
- super(name)
- @id = id
- @add = add || [0, 0]
- @animation = animation || false
- @y_active = true
- @y = 0
- self.x = ($game_map.events[@id].screen_x - (self.width / 2)) + @add[0]
- self.y = ($game_map.events[@id].screen_y - 56) + @add[1]
- end
- #----------------------------------------------------------------------------
- # • Renovação dos objetos.
- #----------------------------------------------------------------------------
- def dispose
- self.visible = false
- end
- #----------------------------------------------------------------------------
- # • Atualização dos objetos.
- #----------------------------------------------------------------------------
- def update
- self.visible = true
- self.x = ($game_map.events[@id].screen_x - (self.width / 2)) + @add[0]
- unless @animation
- self.y = ($game_map.events[@id].screen_y - 56) + @add[1]
- else
- if @y_active
- @y += 1
- self.y = ($game_map.events[@id].screen_y - 56) + @add[1] + @y
- @y_active = false if @y > 5
- else
- @y -= 1
- self.y = ($game_map.events[@id].screen_y - 56) + @add[1] + @y
- @y_active = @y < -5
- end
- end
- end
- end
- #==============================================================================
- # • Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- #----------------------------------------------------------------------------
- # • Desenhar imagem.
- #----------------------------------------------------------------------------
- def poe(id, name, animation=nil, add=nil)
- PoE.draw(id, name, animation, add)
- end
- end
- #==============================================================================
- # • Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- #----------------------------------------------------------------------------
- # • Renovação dos objetos.
- #----------------------------------------------------------------------------
- alias :poe_terminate :terminate
- def terminate
- poe_terminate
- PoE.dispose
- end
- #----------------------------------------------------------------------------
- # • Atualização dos objetos.
- #----------------------------------------------------------------------------
- alias :poe_update :update
- def update
- poe_update
- PoE.update
- end
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment