Sombra nos chars e Eventos
O nome do script já diz tudo, adicione este script abaix o Sprite Reflection(script postado pela nossa atiradora(Hat)) assim o jogo fica mais profissa....
@edit = Screenshot adicionada
Screem do Efeito
O nome do script já diz tudo, adicione este script abaix o Sprite Reflection(script postado pela nossa atiradora(Hat)) assim o jogo fica mais profissa....
@edit = Screenshot adicionada
Screem do Efeito
- Código:
################################################################################
# Sombra de characters #
################################################################################
#-----------------------------Características----------------------------------#
################################################################################
# Deixa todos os characters, eventos e veículos com sombra. #
################################################################################
#------------------------------Configurações-----------------------------------#
################################################################################
module Config
# Um tile possui 32 pixels.
X = 0 # Dinstância da sombra em relação ao
# character no eixo x (horizontal), em pixels.
Y = 32 # Dinstância da sombra em relação ao
# character no eixo y (vertical), em pixels.
X_Comment = "X" # Comentário que deve-se colocar em um evento
# para mudar a distância entre ele e sua
# sombra em relação ao eixo x.*
Y_Comment = "Y" # Comentário que deve-se colocar em um evento
# para mudar a distância entre ele e sua
# sombra em relação ao eixo y.*
No_Shadow_Comment = "No Shadow" # Comentário que deve-se colocar em um evento
# para que esta não possua sombra.
Invert = true # Inverte a sombra (true ou false).
Invert_Comment = "Invert" # Comentário que deve-se colocar em um evento
# para inverter ou desinverter a sombra.
# * Como usar: Colocar a quantidade desejada após o cometário, separado por um
# espaço.
end
################################################################################
class Game_Event < Game_Character
def read_comment(comment)
for command in @list
next if command.code != 108
return command.parameters[0] if command.parameters[0].include?(comment)
end
return nil
end
def has_comment?(comment)
for command in @list
next if command.code != 108
return true if command.parameters[0].include?(comment)
end
return false
end
end
class Sprite_Shadow < Sprite_Base
def initialize(viewport, invert, character = nil, x = 0, y = 0)
super(viewport)
@x = x
@y = y
@character = character
@invert = invert
update
end
def dispose
super
end
def update
super
update_bitmap
update_src_rect
update_position
update_other
end
def tileset_bitmap(tile_id)
Cache.tileset($game_map.tileset.tileset_names[5 + tile_id / 256])
end
def update_bitmap
if graphic_changed?
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_index = @character.character_index
if @tile_id > 0
set_tile_bitmap
else
set_character_bitmap
end
end
end
def graphic_changed?
@tile_id != @character.tile_id ||
@character_name != @character.character_name ||
@character_index != @character.character_index
end
def set_tile_bitmap
sx = (@tile_id / 128 % 2 * 8 + @tile_id % * 32
sy = @tile_id % 256 / 8 % 16 * 32
self.bitmap = tileset_bitmap(@tile_id)
self.src_rect.set(sx, sy, 32, 32)
self.ox = 16
self.oy = 32
end
def set_character_bitmap
self.bitmap = Cache.character(@character_name)
self.tone = Tone.new(-255,-255,-255)
if @invert
self.angle = 270
self.mirror = true
self.angle = 180
self.mirror = false
end
sign = @character_name[/^[\!\$]./]
if sign && sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
end
self.ox = @cw / 2 - Config::X - @x
self.oy = @invert ? (@ch + 32 - Config::Y + @y) : @ch - Config::Y - @y
end
def update_src_rect
if @tile_id == 0
index = @character.character_index
pattern = @character.pattern < 3 ? @character.pattern : 1
sx = ((index % 4 * 3 + pattern) * @cw)
if @invert
sy = ((index / 4 * 4 + (10 - @character.direction - 2) / 2) * @ch)
else
sy = ((index / 4 * 4 + (@character.direction - 2) / 2) * @ch)
end
self.src_rect.set(sx, sy, @cw, @ch)
end
end
def update_position
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z
end
def update_other
self.opacity = @character.opacity/2
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
self.visible = !@character.transparent
end
end
class Spriteset_Map
def create_characters
@character_sprites = []
$game_map.events.values.each do |event|
if !event.has_comment?(Config::No_Shadow_Comment)
x = 0
y = 0
invert = event.has_comment?(Config::Invert_Comment)
if invert
if Config::Invert
invert = false
end
else
invert = Config::Invert
end
x = event.read_comment(Config::X_Comment)[Config::X_Comment.size..event.read_comment(Config::X_Comment).size].to_i if event.has_comment?(Config::X_Comment)
y = event.read_comment(Config::Y_Comment)[Config::Y_Comment.size..event.read_comment(Config::Y_Comment).size].to_i if event.has_comment?(Config::Y_Comment)
@character_sprites.push(Sprite_Shadow.new(@viewport1, invert, event, x, y))
end
@character_sprites.push(Sprite_Character.new(@viewport1, event))
end
$game_map.vehicles.each do |vehicle|
invert = Config::Invert
@character_sprites.push(Sprite_Shadow.new(@viewport1, invert, vehicle))
@character_sprites.push(Sprite_Character.new(@viewport1, vehicle))
end
$game_player.followers.reverse_each do |follower|
invert = Config::Invert
@character_sprites.push(Sprite_Shadow.new(@viewport1, invert, follower))
@character_sprites.push(Sprite_Character.new(@viewport1, follower))
end
invert = Config::Invert
@character_sprites.push(Sprite_Shadow.new(@viewport1, invert, $game_player))
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
@map_id = $game_map.map_id
end
end
Última edição por Komuro Takashi em Seg Jun 18, 2012 12:35 pm, editado 3 vez(es)