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 commands but same effect? WT...?

What is the difference, if any, between these two commands (other than the obvious fact that one has .rect in the middle)?

bitmap.rect.height

bitmap.height

The first is located in Window_SaveFile and the second is located in Window_Base and Sprite_Character yet they seem to do the same thing...

Does it make a difference which is used?
 
There is one : try in Window_SaveFile the code :
Code:
        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
        bitmap.rect.height = 200
        p bitmap.height

It will display 320
However, if you try that on a bitmap, its true height will still be 320... Don't really know what rect is for.
 
Easy

Rect is the rectangle that will be shown from the bitmap in the sprite, where Viewport is the area on the screen where it can be shown.

Ex.

Character graphic.

.height = full height
.rect.height = 1 frame height
 
One of the great mysterious of RGSS

I think that it was included as a shortcut for the blt and stretch_blt methods so instead of doing

Code:
<bitmapa>.blt(0, 0, <bitmapb>, Rect.new(0, 0, <bitmapb>.width, <bitmapb>.height))

you can do

Code:
<bitmapa>.blt(0, 0, <bitmapb>, <bitmapb>.rect)
 
Me(tm), you're talking about sprites, not bitmaps. The sprite thing was obvious, but the behaviour is different for bitmaps (it doesn't seems to 'cut' the bitmap)

Trickster : quite elegant indeed.
 

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