Sky Makers
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Sombra Realista

Ir para baixo

Sombra Realista Empty Sombra Realista

Mensagem por Yuri Azuos Qui Jan 26, 2012 2:42 pm

Este script cria uma sombra perto do herói e de eventos. A sombra é fiel ao formato do gráfico. No script da para mudar o ângulo da sombra, a cor dela e a opacidade.

[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]
Código:
#==============================================================================
# Efeito de Sombra        || Por Mendesx
#------------------------------------------------------------------------------
#  Este script cria uma sombra perto do herói e de eventos. A
# sombra é fiel ao formato do gráfico.
#==============================================================================
module CONF # Configurações
  # Angulo da sombra
  ANGLE = 210
  # Cor da sombra
  COLOR = [30, 20, 30, 255] # Em RGB
  # Opacidade das sombras
  OPA = 180
end




class Sprite_Character_S < RPG::Sprite
  attr_accessor :character               
  def initialize(viewport, character = nil)
    super(viewport)
    @character = character
    update
  end
  def update
    super
    if @tile_id != @character.tile_id or
      @character_name != @character.character_name or
      @character_hue != @character.character_hue
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_hue = @character.character_hue
      if @tile_id >= 384
        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
          @tile_id, @character.character_hue)
        self.src_rect.set(0, 0, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        self.bitmap = RPG::Cache.character(@character.character_name,
          @character.character_hue)
        @cw = bitmap.width / 4
        @ch = bitmap.height / 4
        self.ox = @cw / 2
        self.oy = @ch
        self.angle = CONF::ANGLE
      end
    end
    self.visible = (not @character.transparent)
    if @tile_id == 0
      sx = @character.pattern * @cw
      sy = (@character.direction - 2) / 2 * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
    self.x = @character.screen_x
    self.y = @character.screen_y - 5
    self.z = @character.screen_z
    self.opacity = CONF::OPA
    self.color.set(CONF::COLOR[0], CONF::COLOR[1], CONF::COLOR[2], CONF::COLOR[3])
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end
  end
end

class Sprite_Shadow < RPG::Sprite
  attr_accessor :character               
  def initialize(viewport, character = nil)
    super(viewport)
    @character = character
    update
  end
  def update
    super
    if @tile_id != @character.tile_id or
      @character_name != @character.character_name or
      @character_hue != @character.character_hue
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_hue = @character.character_hue
      if @tile_id >= 384
        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
          @tile_id, @character.character_hue)
        self.src_rect.set(0, 0, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        self.bitmap = RPG::Cache.character(@character.character_name,
          @character.character_hue)
        @cw = bitmap.width / 4
        @ch = bitmap.height / 4
        self.ox = @cw / 2
        self.oy = @ch
        self.angle = CONF::ANGLE
      end
    end
    self.visible = (not @character.transparent)
    if @tile_id == 0
      sx = @character.pattern * @cw
      sy = (@character.direction - 2) / 2 * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
    self.x = @character.screen_x
    self.y = @character.screen_y - 5
    self.z = @character.screen_z
    self.color.set(CONF::COLOR[0], CONF::COLOR[1], CONF::COLOR[2], CONF::COLOR[3])
    self.opacity = CONF::OPA
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end
  end
end

class Spriteset_Map
  alias sh initialize
  alias dh dispose
  alias uh update
  def initialize
    sh
    @character_shadows = []
    for i in $game_map.events.keys.sort
      shadow = Sprite_Shadow.new(@viewport1, $game_map.events[i])
      @character_shadows.push(shadow)
    end
    @character_shadows.push(Sprite_Character_S.new(@viewport1, $game_player))
  end
  def dispose
    for shadow in @character_shadows
      shadow.dispose
    end
    dh
  end
  def update
    return if @character_shadows == nil
    for shadow in @character_shadows
      shadow.update
    end
    uh
  end
end
Créditos:
Ao MendesX-Por Criar
Yuri Azuos-Por dispor.
Yuri Azuos
Yuri Azuos
Deus
Deus

Mensagens : 81
Dom de anjo: : 9
Data de inscrição : 24/01/2012
Idade : 25
Localização : Bertioga-SP

https://skymakers.forumeiros.com

Ir para o topo Ir para baixo

Ir para o topo


 
Permissões neste sub-fórum
Não podes responder a tópicos