![]() The RPG Maker team should have called this class something like Tilesets or TilesetPack to strengthen the idea it's a group of tilesets, not just one. There are in fact 9 slots referring to a tileset type as follow: A1, A2, A3, A4, A5, B, C, D, E. I find the term a bit misleading because in truth the structure holds more than only one tileset. ![]() RGSS has a data structure called Tileset. In a future tutorial, we'll learn how to create a procedural map from scratch by code. The Map data structure comes with so many properties such as width, height, tilemap data, linked tilesets, etc. The load_data() function can be used for all rvdata files, as demonstrated in the next section. So, it's wise to remember the sprintf() function for this kind of situation.Īs you can see, it's very easy to load a map via scripting. More lines of code would be required if such feature had to be written by hand. The %3d sequence allows to pad a digit with three leading zeros. What's interesting about the above snippet is that this function allows to use a special flag in the string format that acts like a dynamic variable. Map_id = load_data( sprintf("Data/Map%03d.rvdata2", map_id) ) To see the top viewport in action, you can add the following snippet in the loop-do block: ![]() TEST TOP SCREEN WITH GAMEPAD/KEYBOARD INPUT In the above snapshot, the monsters have been clipped to their respective viewport. Just like the 3DS screens, their contents will never get outside the boundary of the rectangular area for each viewport. The two other viewports are drawn over the background viewport. The 3DS image itself doesn't fill the entire screen, so used this simple formula, center_x = (screen_width/2) - (bmp_3ds.width/2), and then shifted the offset value horizontally, viewport_A.ox -= center_x, to center the image. One is covering the entire screen and is used to display the Nintendo 3DS in the background. I've created three viewports for this scene. Offset coordinates will shift the content inside the viewport horizontally and vertically. The regular coordinate is the absolute position of the viewport within the screen. Regular coordinates can be set only during the object initialization: Viewport.new(0, 0, screen_width, screen_height). Regular coordinates and offset coordinates. It's important to know that the viewport has two types of coordinates. So, set it inside a loop statement: loop do(.)end otherwise the screen is going to be black. It refreshes the game screen and advances time by 1 frame. Then we used its method draw_text to print our 'Hello World!' message on the screen.įinally, we use the RGSS2/RGSS3 built-in module 'Graphics' and its update method Graphics.update. We initialize it to (544, 416), which is the same dimension of the smallest screen resolution. This Bitmap class requires a bit more labor. So, it makes it easy for us to branch things together: my_sprite.bitmap = my_bitmap. The Sprite class possesses a property called 'bitmap', which is nothing else than an encapsulated Bitmap class object. The bitmap object contains the data (soul), and the sprite object is the visual container for the data (body). It may sound a bit confusing for a newbie, but the best analogy for both Bitmap and Sprite classes is a soul/body relationship. Beware: the Bitmap class alone isn't enough to display something on the screen. To display text on the screen, we use two built-in classes from the RPG Maker class library: Sprite and Bitmap.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |