Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

draw actor...

In one of the scripts I have it has a draw_actor_graphic(actor, 24, 96)
is there a way to instead of drawing an actors graphic it does what this does
bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
it makes a picture with the acotrs name _face.png in the character folder?

thanks in advance
 

khmp

Sponsor

Code:
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Graphic !OVERRIDE!
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.character(sprintf('%s_face.png',actor.character_name), 
                    actor.character_hue)
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(0, y - bitmap.height, bitmap, src_rect)
  end
end

Insert an empty section and place in it the code above. actor.character_name gives the name of the graphic being used. So it'll be "001-Fighter_face.png" not "Aluxes_face.png". Just to let you know what you should name the face graphics. If you would rather it be based on the hero's name its actor.name.
 
it dosnt seem to be working, I want to make this script show a face instead of the heros sprite...

def draw_actor_status(actor)
# Clear the contents of the bitmap
self.contents.clear
# If the actor to draw is nil, leave the window empty
return if actor == nil
# Draw the actor's graphic
draw_actor_graphic(actor, 24, 96)
# Draw the actor's name, level
draw_actor_name(actor, 64, 0)
draw_actor_level(actor, 256, 0)
draw_actor_hp(actor, 64, 32)
draw_actor_sp(actor, 64, 64)
end
end

The face is the actors graphic_face.png in the characters folder (sorry I said that wrong in my first post)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top