Pokemon Obelisk Privado
Pokemon como nunca antes lo habías visto
Conectarse

Recuperar mi contraseña

Últimos temas
» MEGAPOST de OBELISK
Sáb Mayo 09, 2015 6:50 am por Cerz

» Grupo de WASS o Skype.
Lun Nov 25, 2013 4:44 am por Hinmo

» Concurso de VideoJuegos (Crear uno)
Sáb Nov 23, 2013 9:37 am por jonan96

» Mi primer sprite
Sáb Ago 24, 2013 2:31 am por Hinmo

» RaidCall Del Proyecto
Vie Ago 23, 2013 9:20 pm por Andy

» Canal de los Beta-Testers
Lun Ago 12, 2013 3:48 am por Hinmo

» Recolor 0.1 F.nk
Miér Mayo 22, 2013 8:09 am por Cerz

» Changelog Beta Privada
Lun Abr 08, 2013 10:03 pm por Hinmo

» Clases Nocturnas
Lun Mar 25, 2013 12:38 pm por Hinmo

» Descarga la Beta Privada.
Jue Mar 21, 2013 5:37 am por Zenel

Sondeo

¿Nombre de la Zona de Hadas?

17% 17% [ 1 ]
0% 0% [ 0 ]
0% 0% [ 0 ]
17% 17% [ 1 ]
67% 67% [ 4 ]

Votos Totales : 6

Mejores posteadores
Zenel (2775)
 
Hinmo (2768)
 
Cerz (2190)
 
Zap27 (1442)
 
Brown34 (692)
 
Alícia F. R. (566)
 
jonan96 (521)
 
Atrixy (508)
 
evergrud (348)
 
gadesx (320)
 


Reflejos

Ver el tema anterior Ver el tema siguiente Ir abajo

Reflejos

Mensaje por Zenel el Dom Ago 01, 2010 12:43 am

Script de Reflejos

Con este genial script tenemos la posibilidad de crear un reflejo de un evento o un personaje en el area que designemos, ya sea agua o no.


Script:
Spoiler:


Código:
#==============================================================================
# ** TDS Sprite Reflect
# Version: 1.0
#------------------------------------------------------------------------------
# This script makes specially desigated areas reflect the character sprite and
# events.
#==============================================================================
# Instructions:
#
# Create areas using the area creator of the map editor and call them "Reflect".
#
# For events you can use these two commands in part of their name.
#
# Reflect
#
# Any event with "Reflect" as part of it's name will have the reflect effect on
# the special areas of the map.
#
#
# /OFFSET[#]
#
#  [#] = Numerical value of the offset.
#
#  Example:
#  /OFFSET[10]
#
# Offset changes the Y offset of the sprite in the water.(How far is the
# Reflection from the characters original standing point)
#
#
# $game_player.reflect_offset = #
#
#  # = Value of the character offset.
#
# Just the same as the event offset except this one handles the characters
# offset reflection.
#==============================================================================


  #--------------------------------------------------------------------------
  # * Constants for activating the wave effect on the water
  #--------------------------------------------------------------------------
  WATER_WAVE_EFFECT = true

 
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display characters. It observes a instance of the
# Game_Character class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Reflect < Sprite_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :character
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    viewport  : viewport
  #    character : character (Game_Character)
  #--------------------------------------------------------------------------
  def initialize(viewport = nil, character = nil, offset = nil)
    super(viewport)
    @character = character
    @player_offset = $game_player.reflect_offset   
    @offset = (@character.is_a?(Game_Player) ? @player_offset : offset)
    sprite_setup   
    update
  end
  #--------------------------------------------------------------------------
  # * Sprite Setup
  #--------------------------------------------------------------------------
  def sprite_setup
    self.bitmap = Cache.character(@character.character_name)           
    self.angle = 180
    self.mirror = true   
    self.opacity = 120     
    sign = @character.character_name[/^[\!\$]./]
      if sign != nil and sign.include?('$')
      @cw = bitmap.width / 3
      @ch = bitmap.height / 4
      else
      @cw = bitmap.width / 12
      @ch = bitmap.height / 8
    end             
    @cw = bitmap.width / 12
    @ch = bitmap.height / 8             
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super   
    index = @character.character_index
    pattern = @character.pattern < 3 ? @character.pattern : 1
    sx = (index % 4 * 3 + pattern) * @cw
    sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    self.src_rect.set(sx, sy, @cw, @ch)   
   
    self.ox = 16   
    if @character.is_a?(Game_Player)
      self.oy = 38 + $game_player.reflect_offset   
    else
      self.oy = 38 + @offset
    end
   
    self.x = @character.screen_x
    self.y = @character.screen_y
    self.z = @character.screen_z

    if WATER_WAVE_EFFECT == true   
      self.wave_amp = 1
      self.wave_length = 1
      self.wave_speed = 3
    end     
  end
end


#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc. It's used
# within the Scene_Map class.
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Create Character Sprite
  #--------------------------------------------------------------------------
  alias tds_sprite_reflection_create_characters create_characters
  def create_characters
    tds_sprite_reflection_create_characters   
    @character_sprites = []
    @event_reflection_sprite = []
    @reflecting_events = []
    for i in $game_map.events.keys.sort
      sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
      @character_sprites.push(sprite)
    end
    for vehicle in $game_map.vehicles
      sprite = Sprite_Character.new(@viewport1, vehicle)
      @character_sprites.push(sprite)
    end
    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
    for i in $game_map.events.keys.sort   
    @event_name_offset = $game_map.events[i].name   
    @event_name_offset[ /\/OFFSET\[(.*?)\]/ ]
    sprite = Sprite_Reflect.new(@viewport1, $game_map.events[i], $1 != nil ? $1.to_i : 0)     
    if $game_map.events[i].name.include?("Reflect") 
      @event_reflection_sprite.push(sprite)     
      @reflecting_events.push($game_map.events[i])
      end
    end
    @reflection_sprite = Sprite_Reflect.new(@viewport1, $game_player, 0)           
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias tds_sprite_reflection_update update 
  def update
    tds_sprite_reflection_update   
    if $game_player.current_area_name == "Reflect"
    if $game_player.moving? == false
      @reflection_sprite.visible = true       
    end
    else       
    @reflection_sprite.visible = false               
    end
   
    for i in 0...@reflecting_events.size
    if @reflecting_events[i].current_area_name == "Reflect"
      if @reflecting_events[i].moving? == false
        @event_reflection_sprite[i].visible = true       
      end
    else
      @event_reflection_sprite[i].visible = false     
    end   
    end
 
    if @reflection_sprite.visible == true         
      @reflection_sprite.update
    end
   
    for i in 0...@event_reflection_sprite.size
      if @event_reflection_sprite[i].visible == true
        @event_reflection_sprite[i].update         
      end
    end
   
    update_tilemap
    update_parallax
    update_characters
    update_shadow
    update_weather
    update_pictures
    update_timer
    update_viewports
  end 
end



#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================

class Game_Character

  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor  :reflect_offset              # Character Reflection Offset 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias tds_sprite_reflection_initialize initialize
  def initialize
    tds_sprite_reflection_initialize   
    @reflect_offset = 0
  end
 
  #--------------------------------------------------------------------------
  # * Current Area Name
  #--------------------------------------------------------------------------
  def current_area_name
    # Checks the areas in the maps
    for area in $data_areas.values
      # If the character is currently on an area
      if in_area?(area) == true
        # Give the value of the name of the area to the return variable
        return_area_name = area.name
        # Break loop
        break
      end   
    end   
    return return_area_name
  end
end


#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
 
  #--------------------------------------------------------------------------
  # * Clear Starting Flag
  #--------------------------------------------------------------------------
  def name
    return @event.name
  end
   
  #--------------------------------------------------------------------------
  # * Determine if in Area
  #    area : Area data (RPG::Area)
  #--------------------------------------------------------------------------
  def in_area?(area)
    return false if area == nil
    return false if $game_map.map_id != area.map_id
    return false if @x < area.rect.x
    return false if @y < area.rect.y
    return false if @x >= area.rect.x + area.rect.width
    return false if @y >= area.rect.y + area.rect.height
    return true
  end
end

Instrucciones:

Para usarlo hay que crear el AREA donde quieren que el chara se refleje (el area es donde el chara se para no donde va el reflejo) y ponerle de nombre Reflect (el nombre se le pone al area, no al evento)
Si quieren que un evento se refleje le ponene Reflect en el nombre (asi de facil)
Si quieren que el reflejo del evento comienze unos pixeles mas abajo, le ponen /OFFSET[#] en el nombre (a demas de Reflect) # es el numero de pixeles Ej: Reflect /OFFSET[15]
Si quieren lo mismo pero con el chara ponen un llamado a script que diga $game_player.reflect_offset = # (# = numero de pixeles)

Si quieres sacarle el efecto de movimiento busca WATER_WAVE_EFFECT = true y cambialo por WATER_WAVE_EFFECT = false


Screens:




Sinceramente, un script genial, cualquier duda, preguntadla, si se puede se ayudará ^^

Creditos a SephirothTDS
avatar
Zenel
Admin

Masculino Mensajes : 2775
Reputación : 18
Fecha de inscripción : 04/04/2010
Edad : 31
Localización : España/ Castellon

Ver perfil de usuario http://pokemonobelisk.foro-espana.es

Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba

- Temas similares

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