|
draw_background_tiled - draws a background image, tiled to fill the room. Syntaxdraw_background_tiled ( back, x, y );
Explanationdraw_background_tiled() draws a background at position (x,y) in the room during run time and tiles it to fill the entire room. The background image is defined in the background resources by the programmer. ExamplesSeasons ChangeBy creating a background of each season that you wish to depict, you would be able to change the seasons by changing the background. In a room where the image was pretty much all white snow or all green grass one could tile that image to fill the entire room. Keep in mind that this only effects the background and further coding would need to be done if wanting to change the sprite images for the objects to reflect the season. The following would be placed into a draw event of an object and would need a background that was defined as summer_grass_bkgrnd.
Fields of GreyTakes a grey default room and tiles the background with a grass gif that I have on my computer. Create an object which for this example I will leave as object0. The Draw Event of object0 will check for the existence of the newback index. As such we will want to define it and initialize it in the Create Event.
If there is a file named grass.gif on the c: drive in the root directory then the following code will work. If there isn't, then please make sure that you place the correct filename's path in single quotes.
As exciting as it is to load a background image from a file, if we don't draw it then the player will never see it. The following is one method of doing this. First it checks to make sure that the background exists and if it does then it will tile it.
Note: Not exactly sure what the purpose of defining x and y coordinates are as my experience shows that 0,0 produces the same results as 100,100. The entire room is tiled with the background. |
Related Pages
Backlinks |
Draw Background Tiled