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.

Different Faces in Menu

Jaide

Member

Hello. ^_^ Mmkay, well, I want to have it so that the menu shows the characters' faces instead of the sprite, which is simple enough:

Code:
def draw_actor_face(actor, x, y)
  bitmap = RPG::Cache.picture("#{actor.id}")
   cw = bitmap.width 
   ch = bitmap.height 
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x - cw/5, y - ch, bitmap, src_rect)
 end

But I'd like to be able to use different faces per character. For example, if a character is drunk or sick or angry, etc, I want their face in the menu to reflect that. How would I go about doing that?

Thanks!
 
well, im still a newbie in scripting, but i guess you shoul try something like:

Code:
def draw_actor_face(actor, x, y)
  bitmap = RPG::Cache.picture("#{actor.id}")
  if actor.states.include?(#state id of drunk state)
  bitmap = RPG::Cache.picture(actor.name + "_drunk.png")
 end
   cw = bitmap.width 
   ch = bitmap.height 
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x - cw/5, y - ch, bitmap, src_rect)
 end

i dont know if it works, or is what was you asking for, but im just giving out my guess.
 

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