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.

save, using faces instead of character sprites

I believe i need to change these lines, but i cant seem to get it right

The faces are in the Pictures folder and are named using the name of the character

Code:
      for i in 0...@characters.size
        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
        cw = bitmap.rect.width / 4
        ch = bitmap.rect.height / 4
        src_rect = Rect.new(0, 0, cw, ch)
        x = 300 - @characters.size * 32 + i * 64 - cw / 2
        self.contents.blt(x, 68 - ch, bitmap, src_rect)
      end
 

Mac

Member

Change it to this :)

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
 

S0L0

Member

dunno if it helps u, but the actual code I use, is this one:

Code:
      for i in 0...@characters.size
        bitmap = RPG::Cache.picture(@characters[i][0])
        src_rect = Rect.new(0, 0, 80, 80)
        x = 80 + i * 80
        self.contents.blt(x, 1, bitmap, src_rect)
      end
 

S0L0

Member

the
x = 80 + i * 80

is the space betwen each face, work a lil with first value then the 2nd vlaue for see wich one u think will be betetr edit for your purpose
 

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