View difference between Paste ID: qSvMnUCF and VUWSmCEk
SHOW: | | - or go back to the newest paste.
1
#==============================================================================
2
# • Picture Over Event
3
#==============================================================================
4-
# Autor: Dax
4+
# Author: Dax
5-
# Versão: 1.1
5+
# Version: 1.4
6
# Site: www.dax-soft.weebly.com
7-
# Requerimento: Dax Core
7+
# Requirements: Dax Core
8
#==============================================================================
9-
# • Descrição:
9+
# • Desc:
10
#------------------------------------------------------------------------------
11-
#  Permite que você ponha uma imagem por cima da cabeça de um evento.
11+
#  You can put an picture above the head of a event. Leaving him stopped or 
12-
# Deixando ela parada ou animada.
12+
# animated.
13
#==============================================================================
14-
# • Como usar: NO COMANDO CHAMAR SCRIPTS
14+
# • How to Use: In Call Scripts.
15
#------------------------------------------------------------------------------
16
# poe(id, name, animation, [x, y])
17-
#  * id : ID do evento! 
17+
#  * id : Event ID.
18-
#  * name : Nome da imagem que deve estar na pasta Pictures;
18+
#  * name : Filename of the image, must it be in folder Picture.
19-
#  * animation : Sê irá ter uma pequena animação. true - sim | false - não.
19+
#  * animation : |true| for yes and |false| for no.
20-
#    Por padrão já vem definido como não, então se quiser não precisa definir.
20+
#  * x : Add pos X
21-
#  * x : Posição X adicional.
21+
#  * y : Add pos Y
22-
#  * y : Posição Y adicional.
22+
23-
#    Por padrão já vem definido, então não precisa definir.
23+
Dax.register(:picture_over_event, "Dax", 1.4) {
24
#==============================================================================
25-
Dax.register(:picture_over_event, "Dax", 1.1, "05/03/14")
25+
26
#==============================================================================
27
module PoE
28
  extend self
29-
module Rpg::PoE
29+
30
  # • Variável.
31
  #----------------------------------------------------------------------------
32
  @poe ||= []
33
  #----------------------------------------------------------------------------
34
  # • Criar.
35
  #----------------------------------------------------------------------------
36
  def draw(id, name, animation, add)
37
    return if @poe[id.__id__]
38
    @poe[id.__id__] = Sprite_PoE.new("P: #{name}", id, animation, add)
39-
    @poe << Sprite_PoE.new("P: #{name}", id, animation, add)
39+
40
  #----------------------------------------------------------------------------
41
  # • Renovar.
42
  #----------------------------------------------------------------------------
43
  def dispose
44
    return if @poe.is_a?(NilClass)
45-
    @poe.each(&:dispose)
45+
    @poe.each { |i| i.dispose unless i.nil? }
46
  end
47
  #----------------------------------------------------------------------------
48
  # • Atualizar.
49
  #----------------------------------------------------------------------------
50
  def update
51-
    @poe.each { |poe| poe.update unless poe.nil? or poe.disposed?}
51+
    return if @poe.nil?
52
    @poe.each { |i| i.update unless i.nil? or i.disposed?}
53
  end
54
end
55
#==============================================================================
56
# • Sprite.
57
#==============================================================================
58
class Sprite_PoE < Sprite
59
  #----------------------------------------------------------------------------
60
  # • Inicialização dos objetos.
61
  #----------------------------------------------------------------------------
62
  def initialize(name, id, animation, add)
63
    super(name)
64
    @id = id
65
    @add = add || [0, 0]
66
    @animation = animation || false
67
    @y_active = true
68
    @y = 0
69
    self.x = ($game_map.events[@id].screen_x - (self.width / 2)) + @add[0]
70
    self.y = ($game_map.events[@id].screen_y - 56) + @add[1]
71
  end
72
  #----------------------------------------------------------------------------
73
  # • Renovação dos objetos.
74
  #----------------------------------------------------------------------------
75-
    self.bitmap.dispose unless self.bitmap.disposed?
75+
76-
    super
76+
    self.visible = false
77
  end
78
  #----------------------------------------------------------------------------
79
  # • Atualização dos objetos.
80
  #----------------------------------------------------------------------------
81
  def update
82-
    return if self.nil? or self.bitmap.nil?
82+
    self.visible = true
83
    self.x = ($game_map.events[@id].screen_x - (self.width / 2)) + @add[0]
84
    unless @animation
85
      self.y = ($game_map.events[@id].screen_y - 56) + @add[1]
86
    else
87
      if @y_active
88
        @y += 1
89
        self.y = ($game_map.events[@id].screen_y - 56) + @add[1] + @y
90
        @y_active = false if @y > 5
91
      else
92
        @y -= 1
93
        self.y = ($game_map.events[@id].screen_y - 56) + @add[1] + @y 
94
        @y_active = @y < -5
95
      end
96
    end
97
  end
98
end
99
#==============================================================================
100
# • Game_Interpreter
101
#==============================================================================
102
class Game_Interpreter
103
  #----------------------------------------------------------------------------
104
  # • Desenhar imagem.
105
  #----------------------------------------------------------------------------
106
  def poe(id, name, animation=nil, add=nil)
107-
    Rpg::PoE.draw(id, name, animation, add)
107+
    PoE.draw(id, name, animation, add)
108
  end
109
end
110
#==============================================================================
111
# • Scene_Map
112
#==============================================================================
113
class Scene_Map < Scene_Base
114
  #----------------------------------------------------------------------------
115
  # • Renovação dos objetos.
116
  #----------------------------------------------------------------------------
117
  alias :poe_terminate :terminate
118
  def terminate
119
    poe_terminate
120-
    Rpg::PoE.dispose
120+
    PoE.dispose
121
  end
122
  #----------------------------------------------------------------------------
123
  # • Atualização dos objetos.
124
  #----------------------------------------------------------------------------
125
  alias :poe_update :update
126
  def update
127
    poe_update
128-
    Rpg::PoE.update
128+
    PoE.update
129
  end
130-
end
130+
131
}