DaxSoft

PoE 1.1

Mar 6th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. # • Picture Over Event
  3. #==============================================================================
  4. # Autor: Dax
  5. # Versão: 1.1
  6. # Site: www.dax-soft.weebly.com
  7. # Requerimento: Dax Core
  8. #==============================================================================
  9. # • Descrição:
  10. #------------------------------------------------------------------------------
  11. # Permite que você ponha uma imagem por cima da cabeça de um evento.
  12. # Deixando ela parada ou animada.
  13. #==============================================================================
  14. # • Como usar: NO COMANDO CHAMAR SCRIPTS
  15. #------------------------------------------------------------------------------
  16. # poe(id, name, animation, [x, y])
  17. # * id : ID do evento!
  18. # * name : Nome da imagem que deve estar na pasta Pictures;
  19. # * animation : Sê irá ter uma pequena animação. true - sim | false - não.
  20. # Por padrão já vem definido como não, então se quiser não precisa definir.
  21. # * x : Posição X adicional.
  22. # * y : Posição Y adicional.
  23. # Por padrão já vem definido, então não precisa definir.
  24. #==============================================================================
  25. Dax.register(:picture_over_event, "Dax", 1.1, "05/03/14")
  26. #==============================================================================
  27. # • Rpg::PoE
  28. #==============================================================================
  29. module Rpg::PoE
  30. extend self
  31. #----------------------------------------------------------------------------
  32. # • Variável.
  33. #----------------------------------------------------------------------------
  34. @poe ||= []
  35. #----------------------------------------------------------------------------
  36. # • Criar.
  37. #----------------------------------------------------------------------------
  38. def draw(id, name, animation, add)
  39. @poe << Sprite_PoE.new("P: #{name}", id, animation, add)
  40. end
  41. #----------------------------------------------------------------------------
  42. # • Renovar.
  43. #----------------------------------------------------------------------------
  44. def dispose
  45. @poe.each(&:dispose)
  46. end
  47. #----------------------------------------------------------------------------
  48. # • Atualizar.
  49. #----------------------------------------------------------------------------
  50. def update
  51. @poe.each { |poe| poe.update unless poe.nil? or poe.disposed?}
  52. end
  53. end
  54. #==============================================================================
  55. # • Sprite.
  56. #==============================================================================
  57. class Sprite_PoE < Sprite
  58. #----------------------------------------------------------------------------
  59. # • Inicialização dos objetos.
  60. #----------------------------------------------------------------------------
  61. def initialize(name, id, animation, add)
  62. super(name)
  63. @id = id
  64. @add = add || [0, 0]
  65. @animation = animation || false
  66. @y_active = true
  67. @y = 0
  68. self.x = ($game_map.events[@id].screen_x - (self.width / 2)) + @add[0]
  69. self.y = ($game_map.events[@id].screen_y - 56) + @add[1]
  70. end
  71. #----------------------------------------------------------------------------
  72. # • Renovação dos objetos.
  73. #----------------------------------------------------------------------------
  74. def dispose
  75. self.bitmap.dispose unless self.bitmap.disposed?
  76. super
  77. end
  78. #----------------------------------------------------------------------------
  79. # • Atualização dos objetos.
  80. #----------------------------------------------------------------------------
  81. def update
  82. return if self.nil? or self.bitmap.nil?
  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)
  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
  121. end
  122. #----------------------------------------------------------------------------
  123. # • Atualização dos objetos.
  124. #----------------------------------------------------------------------------
  125. alias :poe_update :update
  126. def update
  127. poe_update
  128. Rpg::PoE.update
  129. end
  130. end
Advertisement
Add Comment
Please, Sign In to add comment