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.

how to zoom

Hello,
so in my menu script, it shows the character sprites of the people in the party, of course they are normal size. is there a rgss code that enlarges it.so i can make my characters a little bigger.

draw_actor_graphic(@actor, 56, 80 )

Thats what im using to draw the graphic, is there anything i can add on to that to just make it bigger?
Thanks alot
 
I cooked this in a minute. Let me know if it works. Paste this script above Main.

To call it, you simply add an extra number with the sprite zoom at the end of the method (1.00 is 100%, 1.50 is 150%, 2.00 is 200%, etc.). In example, "draw_actor_graphic(@actor, 56, 80, 2.0)".

Ruby:
#==============================================================================

# ** Window_Base

#------------------------------------------------------------------------------

#  This class is for all in-game windows.

#==============================================================================

 

class Window_Base < Window

  #--------------------------------------------------------------------------

  # * Draw Graphic

  #     actor : actor

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     zoom  : zoom

  #--------------------------------------------------------------------------

  def draw_actor_graphic(actor, x, y, zoom = 1.0)

    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)

    cw = bitmap.width / 4

    ch = bitmap.height / 4

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)

    self.zoom_x = zoom

    self.zoom_y = zoom

  end

end
 
Yeah, sorry about that. I thought I was working with sprites, not windows, which are actually very similar object types. The only other option you have is using the stretch block transfer method. Try this other code. This one I tested myself.

Ruby:
#==============================================================================

# ** Window_Base

#------------------------------------------------------------------------------

#  This class is for all in-game windows.

#==============================================================================

 

class Window_Base < Window

  #--------------------------------------------------------------------------

  # * Draw Graphic

  #     actor : actor

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     zoom  : zoom

  #--------------------------------------------------------------------------

  def draw_actor_graphic(actor, x, y, zoom = 1.00)

    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)

    cw = bitmap.width / 4

    ch = bitmap.height / 4

    src_rect = Rect.new(0, 0, cw, ch)

    cx = x - (cw * zoom / 2)

    cy = y - (ch * zoom)

    dest_rect = Rect.new(cx, cy, cw * zoom, ch * zoom)

    self.contents.stretch_blt(dest_rect, bitmap, src_rect)

  end

end
 
It worked dude, thanks so much for your help, i really do appreciate it. Thats why i love this forum, so many people go out of their way to help people with their projects.
Thanks again man
 

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