TallerGamer
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

(Script)Atlas del Mundo

Ir abajo

(Script)Atlas del Mundo Empty (Script)Atlas del Mundo

Mensaje  MasterMoonNight Vie Feb 03, 2012 3:17 pm

Atlas del Mundo
Autor: Aqua
Versión: 1.00
Tipo: Atlas Display System

Introducción:
Este script crea un atlas que muestra un repertorio de mapas disponibles. También muestra el nombre del mapa y donde está hubicado el personaje.

Características:

- Muestra un Atlas en el mapa.
- Muy personalizable.
- Capaz de mostrar en el mapa donde está el jugador.
- Capaz de mostrar el nombre del mapa.

Screen:

(Script)Atlas del Mundo 71740786[img][/img]

Script:
Código:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
# Atlas Script by TerreAqua
# Version: 1.00
# Type: Fullscreen Map System
# Key Term: Environment Add-on
# Date: 7/29/09
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#

#===============================================================================
# Information
#-------------------------------------------------------------------------------
#
#  This script creates an atlas that displays your repetoire of available maps.
#  It also displays the player's location and the map name.
#
#===============================================================================
module AquaAtlas
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~::~:~:~: Instructions :~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#===============================================================================
# All maps to be shown in the atlas should be in Pictures/Atlas.
# They should all be the same size (in dimensions) and be named according to
# what map id it belongs to (with 3 digits).
# For example, map id 1 should have a picture file that is named 001
#
# Use $scene = Scene_Atlas.new to call up the Atlas.
# Use $game_system.atlas_unlocked.push(MAP_ID) to flag MAP_ID as viewable.
# Use $game_system.atlas_player_icon = 'FILE' to change player's icon.
# Use $game_system.atlas_bg = 'FILE' to change background of atlas.
# Use $game_system.atlas_display_current = true/false to change display mode.
# Use $game_system.atlas_default_map = ID to change default map in atlas.
#
# Complete the below fields.
#===============================================================================

# File in Pictures folder to use as Player Icon
# Leave as '' to have no icon displayed
PLAYERICON = 'Atlas/PlayerIcon'

# File in Pictures folder to use as a background for the Atlas
# Leave as '' to have the map as back
ATLASBG = ''

# The area of the Atlas that is actual terrain
MAP_AREA_X = 480
MAP_AREA_Y = 360

# Where to position the Atlas on the screen
MAP_POS_X = 80
MAP_POS_Y = 60

# This changes the positioning of the Player Icon in case it is off a little
# Can be calculated by taking the top left coordinates of the actual start of
# the map on the map image, then adding MAP_POS_X and MAP_POS_Y respectively
MAP_0X = 80
MAP_0Y = 60

# Where to display the name of the map
NAME_X = 10
NAME_Y = 450

# Which maps to have in the Atlas by default
ENABLED_MAPS = [1, 2, 4, 5, 6]

# Always display current map first?
DISPLAYCURRENT = true

# Default Map - Always shows this first if DISPLAYCURRENT is false
DEFAULT_MAP = 1

# Overrides default setup on certain maps
def self.override(id)
  case id
# when MAP_ID then return ['PICTURE', MAP_0X, MAP_0Y, MAP_AREA_X, MAP_AREA_Y]
  when 4 then return ['004', 217, 60, 206, 360]
  when 5 then return ['Mountainside', 80, 60, 192, 144]
  when 6 then return ['Mountainside', 273, 60, 288, 144]
 
#=============================================================================== 
# Don't edit anything below this line unless you know what you're doing
#===============================================================================
  end
  return [id, MAP_0X, MAP_0Y, MAP_AREA_X, MAP_AREA_Y]
end

end

#===============================================================================
# Credits:
# Aqua (aka TerreAqua) for making this script.
# Evander for requesting it.
# LegacyBlade for finding a potential bug.
# Starrodkirby86 for being you. :D
#===============================================================================

#===============================================================================
#  This work is protected by the following license:
# #-----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #-----------------------------------------------------------------------------
#===============================================================================

class Game_System
 
  attr_accessor :atlas_unlocked
  attr_accessor :atlas_default_map
  attr_accessor :atlas_bg
  attr_accessor :atlas_display_current
  attr_accessor :atlas_player_icon
 
  alias init_atlas_later initialize
  def initialize
    init_atlas_later
    @atlas_unlocked = AquaAtlas::ENABLED_MAPS
    @atlas_default_map = AquaAtlas::DEFAULT_MAP
    @atlas_bg = AquaAtlas::ATLASBG
    @atlas_display_current = AquaAtlas::DISPLAYCURRENT
    @atlas_player_icon = AquaAtlas::PLAYERICON
  end
 
 
end

class Draw_Map < Sprite
 
  def initialize(viewport = nil)
    super
    self.x, self.y, self.z, self.opacity = 0, 0, 10, 255
    self.bitmap = Bitmap.new(640, 480)
   
    if $game_system.atlas_display_current == true &&
          $game_system.atlas_unlocked.include?($game_map.map_id)
      maptoshow = $game_map.map_id
    else
      maptoshow = $game_system.atlas_default_map
    end
   
    if $atlason != true
      $displayedmap = $game_system.atlas_unlocked.index(maptoshow)
      $atlason = true
    end

    $displayedmap = 0 if $displayedmap == nil
   
    # Cleans up array of atlas_unlocked
    $game_system.atlas_unlocked.sort!
    $game_system.atlas_unlocked = $game_system.atlas_unlocked | $game_system.atlas_unlocked
   
    @mapid = $game_system.atlas_unlocked[$displayedmap]
    $map_names = load_data('Data/MapInfos.rxdata')
    $map_names.each_key {|key| $map_names[key] = $map_names[key].name}
 
    refresh
   
  end
 
  # Draws Atlas
  def refresh
    self.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 0))
    @currentmap = sprintf("%03d", @mapid)
   
    if $game_system.atlas_unlocked.include?(@mapid)
      if @mapid == AquaAtlas.override(@mapid)[0]
        map = RPG::Cache.picture("Atlas/#{@currentmap}")
      else
        map = RPG::Cache.picture("Atlas/#{AquaAtlas.override(@mapid)[0]}")
      end
      self.bitmap.blt(AquaAtlas::MAP_POS_X, AquaAtlas::MAP_POS_Y, map, Rect.new(0, 0, map.width, map.height))
      @mapshown = @mapid
      draw_player_location if @mapid == $game_map.map_id
      self.bitmap.draw_text(AquaAtlas::NAME_X, AquaAtlas::NAME_Y, 300, 28, $map_names[@mapshown], 0)
    end
   
    @displayedmap = $displayedmap
   
  end
 
  # Draws player's location if on displayed map
  def draw_player_location
    px, py = $game_player.x, $game_player.y
    map = load_data(sprintf("Data/Map%03d.rxdata", @mapid))
    map_width, map_height = map.width, map.height
    xratio = AquaAtlas.override(@mapid)[3] / map_width.to_f
    yratio = AquaAtlas.override(@mapid)[4] / map_height.to_f
    player = RPG::Cache.picture($game_system.atlas_player_icon)
    ox = player.width / 2 - 16 / xratio
    oy = player.height / 2 - 16 / yratio
    dx = px * xratio + AquaAtlas.override(@mapid)[1]
    dy = py * yratio + AquaAtlas.override(@mapid)[2]
    self.bitmap.blt(dx - ox, dy - oy, player, Rect.new(0, 0, player.width, player.height), 200)
  end
 
  # Checks if map needs to be updated
  def update
    refresh if @mapid != @mapshown
    refresh if @displayedmap != $displayedmap
  end
 
end

class Scene_Atlas
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make Atlas Sprite
    @atlas_sprite = Draw_Map.new
    # Make Map Back
    @back = Spriteset_Map.new
    bg = $game_system.atlas_bg
    if bg != ''
      @bg = Sprite.new
      @bg.bitmap = RPG::Cache.picture(bg)
    end
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @atlas_sprite.dispose
    @back.dispose if @back != nil
    @bg.dispose if @bg != nil
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Reset Map
      $displayedmap = 0
      $atlason = false
      # Switch to menu screen
      $scene = Scene_Menu.new(0)
      return
    end
    # If R button was pressed
    if Input.trigger?(Input::RIGHT)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # To next map
      $displayedmap += 1
      $displayedmap %= $game_system.atlas_unlocked.size
      # Switch to different status screen
      $scene = Scene_Atlas.new
      return
    end
    # If L button was pressed
    if Input.trigger?(Input::LEFT)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # To previous map
      $displayedmap += $game_system.atlas_unlocked.size - 1
      $displayedmap %= $game_system.atlas_unlocked.size
      # Switch to different status screen
      $scene = Scene_Atlas.new
      return
    end
  end
end
Intrucciones: Mirar en el Script
MasterMoonNight
MasterMoonNight
Moderador

Mensajes : 82
Fecha de inscripción : 06/11/2011
Edad : 28
Localización : Argentina

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.