Advertisement
Guest User

Mini Mapa Reino RPG

a guest
May 17th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 24.91 KB | None | 0 0
  1. #==============================================================================
  2. # ReinoRPG Mini-Mapa (RPG Maker VX)
  3. #------------------------------------------------------------------------------
  4. # Bennamy (Amy Productions) & RTH (PRCoders)
  5. # Version 1.0
  6. # 09/10/2008
  7. # Traducido al Castellano por KnuP (A lo que salga xD)
  8. # Modificado por  KnuP (Ver Obs. 2 en las Instrucciones)
  9. #------------------------------------------------------------------------------
  10. # Descripcion:
  11. #
  12. #   Este script exhibe un mini-mapa en una esquina de la pantalla donde en el salen mostrados
  13. #   los tiles pasables y los tiles no pasables (donde el personaje puede caminar
  14. #   y donde él no puede caminar). En el mini-mapa poden ser mostradas las posiciones de
  15. #   ciertos eventos; basta colocar comentários específicos para cada evento.
  16. #   Todos los gráficos exigidos en este mini-mapa son totalmente modificables.
  17. #------------------------------------------------------------------------------
  18. # Instruciones:
  19. #
  20. #   Coloque este script arriba de "Main".
  21. #
  22. #   Copie todas las imagenes necesarias en la carpeta "Pictures" de su proyecto.
  23. #
  24. #   Para exhibir un determinado evento en el minimamapa debe agregar un
  25. #   comentário en la pagina de comandos de este evento. Los comentários pueden ser:
  26. #    - npc = Para NPCs
  27. #    - transporte = Para TELETRANSPORTES/PASAJES
  28. #    - posada = Para POSADAS/PUNTOS PARA SALVAR EL JUEGO
  29. #    - baul = Para BAULES/TESOROS
  30. #    - enemigo = Para ENIMIGOS
  31. #    - otro = Para SHOPS/COMPAÑEROS/ITEMS INTERACTIVOS DEL MAPA
  32. #
  33. #   OBS.: Los comentários de los eventos del mini-mapa pueden ser modificados en:
  34. #         CONFIGURACIONES DE EXHIBICION DE EVENTOS EN EL MINI-MAPA
  35. #
  36. #   **OBS.2: Agrege la opcion de comentario "nada", para que el evento que mostraba el icono de cofre por ejemplo,
  37. #          al pooner esto luego, ya no sera visible en el minimapa, cosa que no hace automaticamente
  38. #          al cambiar de hoja en la pag de eventos.
  39. #
  40. #------------------------------------------------------------------------------
  41. # Personalización:
  42. #
  43. #   Para modificar el Switch que ACTIVA/DESACTIVA el mini-mapa, solo basta buscar donde
  44. #   comienza la CONFIGURACION del script y alterar el valor de MM_ACTIVATED_ID.
  45. #    
  46. #   Para modificar el lugar donde el mini-mapa será exhibido, primero usted debe
  47. #   escojer que variáble definirá el lugar del mini-mapa, esto puede ser hecho
  48. #   alterando el valor de MM_CORNER_VAR. Despues és necesario alterar también el
  49. #   valor de la variáble indicada, por consiguiente, los valores pueden ser:
  50. #    1 = Para exhibir el mini-mapa en la Esquina SUPERIOR IZQUERDA de la pantalla
  51. #    2 = Para exhibir el mini-mapa en la Esquina SUPERIOR DERECHA de la pantalla
  52. #    3 = Para exhibir el mini-mapa en la Esquina INFERIOR IZQUERDA de la pantalla
  53. #    4 = Para exhibir el mini-mapa en la Esquina INFERIOR DERECHA de la pantalla
  54. #
  55. #   OBS.: Modificaciones pueden ser efectuadas en la parte de CONFIGURACIONES del script.
  56. #
  57. #------------------------------------------------------------------------------
  58. # Créditos y Agradecimentos:
  59. #
  60. #   Bennamy (Amy Productions) & RTH (PRCoders) - Por la creacion de este script.
  61. #   Selwyn (squall) - Por haber creado el script para RMXP que era usado como base.
  62. #   Fanha Giang (aka fanha99) - Por el método de exhibir autotiles.
  63. #
  64. #------------------------------------------------------------------------------
  65. # Terminos de Uso y Disponibilidad:
  66. #
  67. #   Usted debe insertar um link hacia el tópico (De este script) del foro ReinoRPG.
  68. #   Usted debe insertar um link hacia www.rmzine.reinorpg.com
  69. #   Usted debe dar creditos a los autores y demas involucrados en la producion de este material.
  70. #   Aun cuando se edite este contenido (script), estas reglas deben valer.
  71. #
  72. #==============================================================================
  73.  
  74.   #--------------------------------------------------------------------------
  75.   # CONFIGURACIONES
  76.   #--------------------------------------------------------------------------
  77. module CONFIG
  78.   # CONFIGURACIONES DE LAS FUNCIONES DEL MINI-MAPA:
  79.   MM_ACTIVATED_ID = 99               # ID del Switch que Activa/Desactiva el MM
  80.   MM_CORNER_VAR = 94                 # Variáble que indica la posición del MM en la pantalla
  81.   MM_OPACITY = 255                  # Transparencia del MM
  82.  
  83.   # CONFIGURACIONES DE LAS IMAGENES EXHIBIDAS EN EL MINI-MAPA:
  84.   MM_MAP_BACK = "bg_map"            # Imagen que representa el Fondo en el MM
  85.   MM_TILES = "tile_map"             # Imagen que representa el Autotile en el MM
  86.   MM_CURSOR = "heroi_cursor"        # Imagen que representa el Personaje en MM
  87.   MM_OTHER = "outro"                # Imagen que representa los Otros Eventos en el MM
  88.   MM_ENEMY = "inimigo"              # Imagen que representa los Enemigos en el MM
  89.   MM_TELEPORT = "passagem"          # Imagen que representa las Pasajes/Transportes en el MM
  90.   MM_CHEST = "bau"                  # Imagen que representa los Baules y Tesoros en el MM
  91.   MM_NPC = "npc"                    # Imagen que representa los Npcs en el MM
  92.   MM_SAVEPOINT = "pousada"          # Imagen que representa las Posadas en el MM
  93.   MM_NADA = "nada"                  # Imagen añadida para que un evento que antes se mostraba, ya no lo haga.  
  94.  
  95.   # CONFIGURACIONES DE EXHIBICION DE EVENTOS EN EL MINI-MAPA:
  96.   MM_EVENT_OTHER = "otro"           # Comentário para exibir el evento "OTRO"
  97.   MM_EVENT_ENEMY = "iglesia"        # Comentário para exibir el evento "ENIMIGO"
  98.   MM_EVENT_TELEPORT = "ciudad"  # Comentário para exibir el evento "TRANSPORTE"
  99.   MM_EVENT_CHEST = "baul"           # Comentário para exibir el evento "BAÚL"
  100.   MM_EVENT_NPC = "npc"              # Comentário para exibir el evento "NPC"
  101.   MM_EVENT_SAVEPOINT = "pub"     # Comentário para exibir el evento "POSADA"
  102.   MM_EVENT_NADA = "nada"            # Comentario para que un evento que se mostraba, ya no se muestre.
  103. end
  104.   #--------------------------------------------------------------------------
  105.   # FIN DE LAS CONFIGURACIONES
  106.   #--------------------------------------------------------------------------
  107.  
  108. #==============================================================================
  109. # Scene_Map
  110. #------------------------------------------------------------------------------
  111. # Classe das operações nos mapas.
  112. #==============================================================================
  113.  
  114. class Scene_Map
  115.   include CONFIG
  116.   #--------------------------------------------------------------------------
  117.   # Lista de métodos aliasados
  118.   #--------------------------------------------------------------------------
  119.   @@pre_terminate_aliased = false
  120.   unless method_defined?(:amy_mm_main)
  121.     alias amy_mm_main main
  122.     alias amy_mm_update update
  123.     alias amy_mm_perform_battle_transition perform_battle_transition
  124.     if method_defined?(:pre_terminate)
  125.       alias amy_mm_pre_terminate pre_terminate
  126.       @@pre_terminate_aliased = true
  127.     end
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # Inicializacion del objeto
  131.   #--------------------------------------------------------------------------
  132.   def initialize
  133.     @corner = $game_variables[MM_CORNER_VAR]
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # Principal
  137.   #--------------------------------------------------------------------------
  138.   def main
  139.     @mini_map = Map_Event.new(@corner)
  140.     amy_mm_main
  141.     @mini_map.dispose
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # Actualizacion de la pantalla
  145.   #--------------------------------------------------------------------------
  146.   def update
  147.     if $game_variables[MM_CORNER_VAR] != @corner
  148.       @corner = $game_variables[MM_CORNER_VAR]
  149.       @mini_map.corner = @corner
  150.     end
  151.     @mini_map.update
  152.     if $game_map.interpreter.running?
  153.       @mini_map.visible = false
  154.     elsif @mini_map.on?
  155.       @mini_map.visible = true
  156.     end
  157.     amy_mm_update
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # Transicion
  161.   #--------------------------------------------------------------------------
  162.   def minimap_transfer
  163.     @mini_map.dispose
  164.     @mini_map = Map_Event.new(@corner)
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # Ejecucion de la transicion de batalla
  168.   #--------------------------------------------------------------------------
  169.   def perform_battle_transition
  170.     @mini_map.visible = false
  171.     amy_mm_perform_battle_transition
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # Fin del processo
  175.   #--------------------------------------------------------------------------  
  176.   def pre_terminate
  177.     @mini_map.visible = true
  178.     amy_mm_pre_terminate if @@pre_terminate_aliased
  179.   end
  180.    
  181. end
  182.  
  183. #==============================================================================
  184. # Game_Player
  185. #------------------------------------------------------------------------------
  186. # Esta classe controla las informaciones del jugador. Entre ellas: los vehículos,
  187. # los eventos (cuando inicián los), o loop del mapa... etc.
  188. # Puede ser accesada utilizando $game_player.
  189. #==============================================================================
  190.  
  191. class Game_Player < Game_Character
  192.   unless method_defined?(:amy_mm_perform_transfer)
  193.     alias amy_mm_perform_transfer perform_transfer
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # Teletransportar
  197.   #--------------------------------------------------------------------------
  198.   def perform_transfer
  199.     amy_mm_perform_transfer
  200.     $scene.minimap_transfer
  201.   end
  202. end
  203.  
  204. #==============================================================================
  205. # Map_Base
  206. #------------------------------------------------------------------------------
  207. # Una clase Base para mini mapas
  208. #==============================================================================
  209.  
  210. class Map_Base < Sprite
  211.   include CONFIG
  212.   #--------------------------------------------------------------------------
  213.   # Constantes e Instancias
  214.   #--------------------------------------------------------------------------
  215.   PMP_VERSION  = 7
  216.   attr_reader :event
  217.   attr_reader :corner
  218.   #--------------------------------------------------------------------------
  219.   # Inicializacion del objeto
  220.   #--------------------------------------------------------------------------
  221.   def initialize(corner)
  222.     super(Viewport.new(16, 16, width, height))
  223.     viewport.z = 8000
  224.     @border = Sprite.new
  225.     @border.x = viewport.rect.x - 6
  226.     @border.y = viewport.rect.y - 6
  227.     @border.z = viewport.z - 1
  228.     @border.bitmap = Cache.picture(MM_MAP_BACK)
  229.     self.visible = on?
  230.     self.opacity = MM_OPACITY
  231.     @corner = -1
  232.     self.corner = corner
  233.     self.visible = on?
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # Corner
  237.   #--------------------------------------------------------------------------
  238.   def corner=(valor)
  239.     return if @corner == valor
  240.     @corner = valor.to_i
  241.     case @corner
  242.     when 2
  243.       self.x = 544 - width - 16
  244.       self.y = 16
  245.     when 3
  246.       self.x = 16
  247.       self.y = 416 - height - 16
  248.     when 4
  249.       self.x = 544 - width - 16
  250.       self.y = 416 - height - 16
  251.     else
  252.       self.x = 16
  253.       self.y = 16
  254.     end
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # Dispose
  258.   #--------------------------------------------------------------------------
  259.   def dispose
  260.     @border.dispose
  261.     super
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # x=
  265.   #--------------------------------------------------------------------------
  266.   def x=(x)
  267.     self.viewport.rect.x = x
  268.     @border.x = x - 6
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # y=
  272.   #--------------------------------------------------------------------------
  273.   def y=(y)
  274.     self.viewport.rect.y = y
  275.     @border.y = y - 6
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # Visible=
  279.   #--------------------------------------------------------------------------
  280.   def visible=(bool)
  281.     super
  282.     self.viewport.visible = bool
  283.     @border.visible = bool
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # Minimap_on?
  287.   #--------------------------------------------------------------------------
  288.   def on?
  289.     return $game_switches[MM_ACTIVATED_ID]
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # Atualizacion de la pantalla
  293.   #--------------------------------------------------------------------------
  294.   def update
  295.     super
  296.     self.visible = on?
  297.     if viewport.ox < display_x
  298.       viewport.ox += 1
  299.     elsif viewport.ox > display_x
  300.       viewport.ox -= 1
  301.     end
  302.     if viewport.oy < display_y
  303.       viewport.oy += 1
  304.     elsif viewport.oy > display_y
  305.       viewport.oy -= 1
  306.     end
  307.   end
  308.    #--------------------------------------------------------------------------
  309.   # Anchura
  310.   #--------------------------------------------------------------------------
  311.   def width
  312.     return 102
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # Altura
  316.   #--------------------------------------------------------------------------
  317.   def height
  318.     return 78
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # Display_x
  322.   #--------------------------------------------------------------------------
  323.   def display_x
  324.     return $game_map.display_x * 3 / 128
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # Display_y
  328.   #--------------------------------------------------------------------------
  329.   def display_y
  330.     return $game_map.display_y * 3 / 128
  331.   end
  332. end
  333.  
  334. #==============================================================================
  335. # Map_Passability
  336. #------------------------------------------------------------------------------
  337. # Exhibe el Mini-mapa
  338. # Agradecimentos para Fanha Giang (a.k.a. fanha99) por el método de exhibir autotiles
  339. #==============================================================================
  340.  
  341. class Map_Passability < Map_Base
  342.   include CONFIG
  343.   #--------------------------------------------------------------------------
  344.   # Constantes
  345.   #--------------------------------------------------------------------------
  346.   INDEX  =
  347.   [
  348.   26, 27, 32, 33,    4, 27, 32, 33,   26,  5, 32, 33,    4,  5, 32, 33,    
  349.   26, 27, 32, 11,    4, 27, 32, 11,   26,  5, 32, 11,    4,  5, 32, 11,    
  350.   26, 27, 10, 33,    4, 27, 10, 33,   26,  5, 10, 33,    4,  5, 10, 33,
  351.   26, 27, 10, 11,    4, 27, 10, 11,   26,  5, 10, 11,    4,  5, 10, 11,  
  352.   24, 25, 30, 31,   24,  5, 30, 31,   24, 25, 30, 11,   24,  5, 30, 11,  
  353.   14, 15, 20, 21,   14, 15, 20, 11,   14, 15, 10, 21,   14, 15, 10, 11,
  354.   28, 29, 34, 35,   28, 29, 10, 35,    4, 29, 34, 35,    4, 29, 10, 35,
  355.   38, 39, 44, 45,    4, 39, 44, 45,   38,  5, 44, 45,    4,  5, 44, 45,
  356.   24, 29, 30, 35,   14, 15, 44, 45,   12, 13, 18, 19,   12, 13, 18, 11,
  357.   16, 17, 22, 23,   16, 17, 10, 23,   40, 41, 46, 47,    4, 41, 46, 47,
  358.   36, 37, 42, 43,   36,  5, 42, 43,   12, 17, 18, 23,   12, 13, 42, 43,
  359.   36, 41, 42, 47,   16, 17, 46, 47,   12, 17, 42, 47,    0,  1,  6,  7
  360.   ]
  361.   X = [0, 1, 0, 1]
  362.   Y = [0, 0, 1, 1]
  363.   #--------------------------------------------------------------------------
  364.   # Inicializacion del objeto
  365.   #--------------------------------------------------------------------------
  366.   def initialize(corner)
  367.     super(corner)
  368.     @autotile = Cache.picture(MM_TILES)
  369.     setup()
  370.   end
  371.   #--------------------------------------------------------------------------
  372.   # setup
  373.   #--------------------------------------------------------------------------
  374.   def setup()
  375.     @map = load_data(sprintf("Data/Map%03d.rvdata", $game_map.map_id))
  376.     @passages = $data_system.passages
  377.     redefine_tiles
  378.     refresh
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # pass
  382.   #--------------------------------------------------------------------------
  383.   def pass(tile_id)
  384.     return 0xf if tile_id == nil
  385.     return @passages[tile_id] != nil ? @passages[tile_id] & 0xf : 15
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # passable
  389.   #--------------------------------------------------------------------------
  390.   def passable(tile_id, flag = 0x01)
  391.     pass = pass(tile_id)
  392.     return true if pass & flag == 0x00    
  393.     return false if pass & flag == flag  
  394.     return false
  395.   end
  396.   #--------------------------------------------------------------------------
  397.   # redefine_tile
  398.   #--------------------------------------------------------------------------
  399.   def redefine_tiles
  400.     width = @map.width
  401.     height = @map.height
  402.     map = RPG::Map.new(width, height)
  403.     map.data = @map.data.dup
  404.     for x in 0...width
  405.       for y in 0...height
  406.         for level in [1, 2]
  407.           id = @map.data[x, y, level]
  408.           if id != 0
  409.             @map.data[x, y, 0] = id
  410.             @passages[@map.data[x, y, 0]] = @passages[id]
  411.           end
  412.         end
  413.       end
  414.     end
  415.     for x in 0...width
  416.       for y in 0...height
  417.         for level in [0]
  418.         tile = @map.data[x, y, level]
  419.         u = @map.data[x,   y-1, level]
  420.         l = @map.data[x-1, y,   level]
  421.         r = @map.data[x+1, y,   level]
  422.         d = @map.data[x,   y+1, level]
  423.         if !passable(tile)
  424.           map.data[x, y] = 0
  425.         else
  426.           if tile == 0
  427.             map.data[x, y, level] = 0
  428.             next
  429.           end
  430.           if pass(tile) > 0
  431.             if !passable(u) and !passable(l) and !passable(r) and !passable(d)
  432.               map.data[x, y, level] = 0
  433.             elsif !passable(u) and !passable(l) and !passable(r) and passable(d)
  434.               map.data[x, y, level] = 90
  435.             elsif !passable(u) and !passable(l) and !passable(d) and passable(r)
  436.               map.data[x, y, level] = 91
  437.             elsif !passable(u) and !passable(r) and !passable(d) and passable(l)
  438.               map.data[x, y, level] = 93
  439.             elsif !passable(l) and !passable(r) and !passable(d) and passable(u)
  440.               map.data[x, y, level] = 92
  441.             elsif !passable(u) and !passable(d) and passable(r) and passable(l)
  442.               map.data[x, y, level] = 81
  443.             elsif !passable(u) and !passable(r) and passable(d) and passable(l)
  444.               map.data[x, y, level] = 84
  445.             elsif !passable(u) and !passable(l) and passable(d) and passable(r)
  446.               map.data[x, y, level] = 82
  447.             elsif !passable(d) and !passable(r) and passable(l) and passable(u)
  448.               map.data[x, y, level] = 86
  449.             elsif !passable(d) and !passable(l) and passable(r) and passable(u)
  450.               map.data[x, y, level] = 88
  451.             elsif !passable(r) and !passable(l) and passable(d) and passable(u)
  452.               map.data[x, y, level] = 80
  453.             elsif !passable(u) and passable(d) and passable(r) and passable(l)
  454.               map.data[x, y, level] = 68
  455.             elsif !passable(d) and passable(u) and passable(r) and passable(l)
  456.               map.data[x, y, level] = 76
  457.             elsif !passable(r) and passable(d) and passable(u) and passable(l)
  458.               map.data[x, y, level] = 72
  459.             elsif !passable(l) and passable(d) and passable(u) and passable(r)
  460.               map.data[x, y, level] = 64
  461.             else
  462.               map.data[x, y, level] = 48
  463.             end
  464.           else
  465.             map.data[x, y, level] = 0
  466.           end
  467.         end
  468.         end
  469.       end
  470.     end
  471.     @map = map.dup
  472.     map = nil
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   # Actualizacion
  476.   #--------------------------------------------------------------------------
  477.   def refresh
  478.     self.visible = false
  479.     self.bitmap = Bitmap.new(@map.width * 6, @map.height * 6)
  480.     bitmap = Bitmap.new(@map.width * 6, @map.height * 6)
  481.     rect1 = Rect.new(6, 0, 6, 6)
  482.     for y in 0...@map.height
  483.       for x in 0...@map.width
  484.         for level in [0]
  485.           tile_id = @map.data[x, y, level]
  486.           next if tile_id == 0
  487.           id = tile_id / 48 - 1
  488.           tile_id %= 48
  489.           for g in 0..3
  490.             h = 4 * tile_id + g
  491.             y1 = INDEX[h] / 6
  492.             x1 = INDEX[h] % 6
  493.             rect2 = Rect.new(x1 * 3, y1 * 3, 3, 3)
  494.             bitmap.blt(x * 6 + X[g] *  3, y * 6 + Y[g] * 3, @autotile, rect2)
  495.           end
  496.         end
  497.       end
  498.     end
  499.     d_rect = Rect.new(0, 0, @map.width * 6, @map.height * 6)
  500.     s_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  501.     self.bitmap.stretch_blt(d_rect, bitmap, s_rect)
  502.     self.viewport.ox = display_x
  503.     self.viewport.oy = display_y
  504.     bitmap.clear
  505.     bitmap.dispose
  506.   end
  507. end
  508.  
  509. #==============================================================================
  510. # Map_Event
  511. #------------------------------------------------------------------------------
  512. #  Exhibe la posicion del Héroe en los Eventos del Mini-mapa
  513. #==============================================================================
  514.  
  515. class Map_Event < Map_Passability
  516.   include CONFIG
  517.   #--------------------------------------------------------------------------
  518.   # Inicializacion del objeto
  519.   #--------------------------------------------------------------------------
  520.   def initialize(corner = 4)
  521.     super(corner)
  522.     @dots = []
  523.     @player = Sprite.new(self.viewport)
  524.     @player.bitmap = Cache.picture(MM_CURSOR)
  525.     @player.src_rect = Rect.new(0, 0, 15, 15)
  526.     @player.z = self.z + 3
  527.     @events = {}    
  528.     for key in $game_map.events.keys
  529.       event = $game_map.events[key]
  530.       next if event.list == nil
  531.       for i in 0...event.list.size
  532.         next if event.list[i].code != 108
  533.         @events[key] = Sprite.new(self.viewport)
  534.         @events[key].z = self.z + 2
  535.         param = event.list[i].parameters[0].downcase
  536.         if param.include?(MM_EVENT_OTHER)
  537.           @events[key].bitmap = Cache.picture(MM_OTHER)
  538.         elsif param.include?(MM_EVENT_ENEMY)
  539.           @events[key].bitmap = Cache.picture(MM_ENEMY)
  540.         elsif param.include?(MM_EVENT_TELEPORT)
  541.           @events[key].bitmap = Cache.picture(MM_TELEPORT)
  542.         elsif param.include?(MM_EVENT_CHEST)
  543.           @events[key].bitmap = Cache.picture(MM_CHEST)
  544.         elsif param.include?(MM_EVENT_NPC)
  545.           @events[key].bitmap = Cache.picture(MM_NPC)
  546.         elsif param.include?(MM_EVENT_NADA)
  547.           @events[key].bitmap = Cache.picture(MM_NADA)
  548.         elsif param.include?(MM_EVENT_SAVEPOINT)
  549.           @events[key].bitmap = Cache.picture(MM_SAVEPOINT)
  550.         end
  551.       end
  552.     end
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # dispose
  556.   #--------------------------------------------------------------------------
  557.   def dispose
  558.     @player.dispose
  559.     for event in @events.values
  560.       event.dispose
  561.     end
  562.     super
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # Actualizacion de la pantalla
  566.   #--------------------------------------------------------------------------
  567.   def update
  568.     super
  569.     @player.x = $game_player.real_x * 3 / 128 - 5
  570.     @player.y = $game_player.real_y * 3 / 128 - 4
  571.     @player.src_rect.x = ($game_player.direction / 2 - 1) * 15
  572.     for key in @events.keys
  573.       event = @events[key]
  574.       mapevent = $game_map.events[key]
  575.       event.x = mapevent.real_x * 3 / 128
  576.       event.y = mapevent.real_y * 3 / 128
  577.       next if mapevent.list == nil
  578.       for list in mapevent.list
  579.         next if list.code != 108
  580.         param = list.parameters[0].downcase
  581.         if param.include?(MM_EVENT_OTHER)
  582.           event.bitmap = Cache.picture(MM_OTHER)
  583.           event.visible = true
  584.           break
  585.         elsif param.include?(MM_EVENT_ENEMY)
  586.           event.bitmap = Cache.picture(MM_ENEMY)
  587.           event.visible = true
  588.           break
  589.         elsif param.include?(MM_EVENT_TELEPORT)
  590.           event.bitmap = Cache.picture(MM_TELEPORT)
  591.           event.visible = true
  592.           break
  593.         elsif param.include?(MM_EVENT_CHEST)
  594.           event.bitmap = Cache.picture(MM_CHEST)
  595.           event.visible = true
  596.           break
  597.         elsif param.include?(MM_EVENT_NPC)
  598.           event.bitmap = Cache.picture(MM_NPC)
  599.           event.visible = true
  600.           break
  601.         elsif param.include?(MM_EVENT_NADA)
  602.           event.bitmap = Cache.picture(MM_NADA)
  603.           event.visible = true
  604.           break
  605.         elsif param.include?(MM_EVENT_SAVEPOINT)
  606.           event.bitmap = Cache.picture(MM_SAVEPOINT)
  607.           event.visible = true
  608.           break
  609.         else
  610.           event.visible = false
  611.         end
  612.       end
  613.     end
  614.   end
  615. end
  616. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement