Sprite_Character imcompatibilidades

0 Respostas   132 Visualizações

0 Membros e 1 Visitante estão vendo este tópico.

hategum rpg

Tópico criado em: 28/01/2015 às 21:17 - Última modificação por hategum rpg em 29/01/2015 às 17:51

Eu estava fazendo os sprites mas quando fui testar no game encontrei alguns erros...gostaria que alguém fizesse uma gambiarra para fazer com que essa "Classe" funcione em harmonia com esses scripts.

No Arc engine
Código: [Selecionar]
#-------------------------------------------------------------------------------
# * Sprite Character
#-------------------------------------------------------------------------------

class Sprite_Character < Sprite_Base
  def set_tile_bitmap
    sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 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 = 31
  end
  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
    else
      @cw = bitmap.width / 12
      @ch = bitmap.height / 8
    end
    self.ox = @cw / 2
    self.oy = @ch -1
  end
end

no Victor Engine - Basic Module
Código: [Selecionar]
#==============================================================================
# ** 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_Character < Sprite_Base
  #--------------------------------------------------------------------------
  # * Overwrite method: set_character_bitmap
  #--------------------------------------------------------------------------
  def set_character_bitmap
    update_character_info
    set_bitmap
    set_bitmap_position
  end
  #--------------------------------------------------------------------------
  # * New method: center_y
  #--------------------------------------------------------------------------
  def actor?
    @character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
  end
  #--------------------------------------------------------------------------
  # * New method: center_y
  #--------------------------------------------------------------------------
  def actor
    actor? ? @character.actor : nil
  end
  #--------------------------------------------------------------------------
  # * New method: update_character_info
  #--------------------------------------------------------------------------
  def update_character_info
  end
  #--------------------------------------------------------------------------
  # * New method: hue
  #--------------------------------------------------------------------------
  def hue
    @character.hue
  end
  #--------------------------------------------------------------------------
  # * New method: set_bitmap
  #--------------------------------------------------------------------------
  def set_bitmap
    self.bitmap = Cache.character(set_bitmap_name, hue)
  end
  #--------------------------------------------------------------------------
  # * New method: set_bitmap_name
  #--------------------------------------------------------------------------
  def set_bitmap_name
    @character_name
  end
  #--------------------------------------------------------------------------
  # * New method: set_bitmap_position
  #--------------------------------------------------------------------------
  def set_bitmap_position
    sign = get_sign
    if sign && sign.include?('$')
      @cw = bitmap.width / @character.frames
      @ch = bitmap.height / 4
    else
      @cw = bitmap.width / (@character.frames * 4)
      @ch = bitmap.height / 8
    end
    self.ox = @cw / 2
    self.oy = @ch
  end
  #--------------------------------------------------------------------------
  # * New method: get_sign
  #--------------------------------------------------------------------------
  def get_sign
    @character_name[/^[\!\$]./]
  end
end

Victor Engine - Multi Frames

Código: [Selecionar]
#==============================================================================
# ** 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_Character < Sprite_Base
  #--------------------------------------------------------------------------
  # * Alias method: update_src_rect
  #--------------------------------------------------------------------------
  alias :update_src_rect_ve_multi_frames :update_src_rect
  def update_src_rect
    if @tile_id == 0 && @character_name[/\[F(\d+)\]/i]
      update_multi_frames_src_rect
    else
      update_src_rect_ve_multi_frames
    end
  end
  #--------------------------------------------------------------------------
  # * New method: update_multi_frames_src_rect
  #--------------------------------------------------------------------------
  def update_multi_frames_src_rect
    index = @character.character_index
    sx = (index % 4 * @character.frames + @character.pattern) * @cw
    sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    self.src_rect.set(sx, sy, @cw, @ch)
  end
end

Edição: Tipo eu coloquei os pedaços que eu achei que causariam a incompatibilidade, não sei ao certo se da pra fazer um conserto ou ter um entendimento com as partes que postei...
Alguém que entende de scripts poderia me dar alguma luz aqui...


Tipo o erro que ocorre é que parece que são cortadas algumas frames (tipo pula algumas poses).
Um cara desenvolvendo um jogo de RPG...
"  Faça o melhor que puder em tudo, simples assim."                    
                              - Hategum RPG.