quarta-feira, 3 de abril de 2013

RPGMAKERVXACE - Usar Chars do XP


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#|Autor: RD12|                  Usar Chars do XP
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#Apenas bote @ no nome do char, exemplo: @Char

class Sprite_Character < Sprite_Base
 
    def set_character_bitmap
    self.bitmap = Cache.character(@character_name)
    sign = @character_name[/^[\!\$\@]./]
    if sign && sign.include?('$')
      @cw = bitmap.width / 3
      @ch = bitmap.height / 4
    elsif sign && sign.include?('@')
      @cw = bitmap.width / 4
      @ch = bitmap.height / 4
    else
      @cw = bitmap.width / 12
      @ch = bitmap.height / 8
    end
    self.ox = @cw / 2
    self.oy = @ch
  end

  def update_src_rect
    if @tile_id == 0
      index = @character.character_index
      pattern = @character.pattern < 3 ? @character.pattern : 1
      sign = @character_name[/^[\!\$\@]./]
    if sign && sign.include?('@')
      pattern = 4 if pattern == 0
      sx = (index % 4 * 4 + (pattern-1)) * @cw  
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    else
      sx = (index % 4 * 3 + pattern) * @cw
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    end
      self.src_rect.set(sx, sy, @cw, @ch)
    end
  end
 
end

Nenhum comentário:

Postar um comentário