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.

[Resolved]Help with Windows, Viewports and Bitmaps

Status
Not open for further replies.

Zymgo

Member

Ok, I pretty much understand Scenes and Windows. What I am trying to do is create an area in my scene (in a window? or is it a window itself?) that is 100 x 100 pixels, that i can show a piece of a 100 x 500 image. The position of the 100x100 will change vertically (scroll) in the larger image as necessary (does that make sense?).

Im just not sure how to accomplish this. Do I use a viewport here? I dont really understand viewports. Do I create a window 100x100 and copy a 100x100 section from the big image? Im not familiar enough with RGSS yet to know how to do this. Im using the SDK and MACL. I notice in the MACL there is a method crop_blt for the bitmap class, is that what Im looking for??

Many Thanks
 
Use the plane class. The plane class is like Sprite, but you initialize a viewport and it tiles the bitmap there.

Code:
object = Plane.new(Viewport.new(x, y, width, height))
object.bitmap = BITMAP

In your update method, use
Code:
object.ox   +-*/%=   x
# and / or
object.oy   +-*/%=   x

Replace the x, y, width, height with the area you want it to be displayed on, BITMAP with a loaded bitmap (such as RPG::Cache.picture('filename'))

Then just replace +-*/%= with something like += 5
 
This topic has been resolved. If Zymgo or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

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