DaxSoft

PoE 1.4

Mar 6th, 2014
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. # • Picture Over Event
  3. #==============================================================================
  4. # Author: Dax
  5. # Version: 1.4
  6. # Site: www.dax-soft.weebly.com
  7. # Requirements: Dax Core
  8. #==============================================================================
  9. # • Desc:
  10. #------------------------------------------------------------------------------
  11. # You can put an picture above the head of a event. Leaving him stopped or
  12. # animated.
  13. #==============================================================================
  14. # • How to Use: In Call Scripts.
  15. #------------------------------------------------------------------------------
  16. # poe(id, name, animation, [x, y])
  17. # * id : Event ID.
  18. # * name : Filename of the image, must it be in folder Picture.
  19. # * animation : |true| for yes and |false| for no.
  20. # * x : Add pos X
  21. # * y : Add pos Y
  22. #==============================================================================
  23. Dax.register(:picture_over_event, "Dax", 1.4) {
  24. #==============================================================================
  25. # • Rpg::PoE
  26. #==============================================================================
  27. module PoE
  28. extend self
  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. end
  40. #----------------------------------------------------------------------------
  41. # • Renovar.
  42. #----------------------------------------------------------------------------
  43. def dispose
  44. return if @poe.is_a?(NilClass)
  45. @poe.each { |i| i.dispose unless i.nil? }
  46. end
  47. #----------------------------------------------------------------------------
  48. # • Atualizar.
  49. #----------------------------------------------------------------------------
  50. def update
  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. def dispose
  76. self.visible = false
  77. end
  78. #----------------------------------------------------------------------------
  79. # • Atualização dos objetos.
  80. #----------------------------------------------------------------------------
  81. def update
  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. 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. PoE.dispose
  121. end
  122. #----------------------------------------------------------------------------
  123. # • Atualização dos objetos.
  124. #----------------------------------------------------------------------------
  125. alias :poe_update :update
  126. def update
  127. poe_update
  128. PoE.update
  129. end
  130. end
  131. }
Advertisement
Add Comment
Please, Sign In to add comment