Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # • Picture Over Event
- #==============================================================================
- # Autor: Dax
- # Versão: 1.0
- # Site: www.dax-soft.weebly.com
- # Requerimento: Dax Core
- #==============================================================================
- # • Descrição:
- #------------------------------------------------------------------------------
- # Permite que você ponha uma imagem por cima da cabeça de um evento.
- # Deixando ela parada ou animada.
- #==============================================================================
- # • Como usar: NO COMANDO CHAMAR SCRIPTS
- #------------------------------------------------------------------------------
- # poe(id, name, animation, [x, y])
- # * id : ID do evento!
- # * name : Nome da imagem que deve estar na pasta Pictures;
- # * animation : Sê irá ter uma pequena animação. true - sim | false - não.
- # Por padrão já vem definido como não, então se quiser não precisa definir.
- # * x : Posição X adicional.
- # * y : Posição Y adicional.
- # Por padrão já vem definido, então não precisa definir.
- #==============================================================================
- Dax.register(:picture_over_event, "Dax", 1.0, "05/03/14")
- #==============================================================================
- # • Rpg::PoE
- #==============================================================================
- module Rpg::PoE
- extend self
- #----------------------------------------------------------------------------
- # • Variável.
- #----------------------------------------------------------------------------
- @poe ||= []
- #----------------------------------------------------------------------------
- # • Criar.
- #----------------------------------------------------------------------------
- def draw(id, name, animation, add)
- @poe << Sprite_PoE.new("P: #{name}", id, animation, add)
- end
- #----------------------------------------------------------------------------
- # • Renovar.
- #----------------------------------------------------------------------------
- def dispose
- @poe.each(&:dispose)
- end
- #----------------------------------------------------------------------------
- # • Atualizar.
- #----------------------------------------------------------------------------
- def update
- @poe.each { |poe| poe.update }
- 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.bitmap.dispose
- super
- end
- #----------------------------------------------------------------------------
- # • Atualização dos objetos.
- #----------------------------------------------------------------------------
- def update
- super
- 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)
- Rpg::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
- Rpg::PoE.dispose
- end
- #----------------------------------------------------------------------------
- # • Atualização dos objetos.
- #----------------------------------------------------------------------------
- alias :poe_update :update
- def update
- poe_update
- Rpg::PoE.update
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment