Repeatable image for sprite?

In my game I have a house with several rooms in different sizes. I have an image of the wallpaper which is about 10px in width and is repeatable. I would like to use this for the walls in the rooms and repeat it on the X axis so that it fills up the width of the room, as their width differ. My game does not implement tilemaps at the moment and probably won't in the future either, so I'd like to solve this without tilemaps if possible. I was thinking something like setting a "wall" sprite to the width of the room and setting the 10px image as the sprite-image, and since the sprite width is bigger than the image width, it would repeat until it is filled.

Is something like this possible? Am I going about it the wrong way? Important to know also is that I need to be able to adjust the Z-index of the wall, so it has to be a sprite and not just an image.

The easiest way to do this is define a custom fill pattern (8x8), then would not have to use an image.

You'd just to and, 0, 400, 240)

Pattern maker web interface:

Another way is to create a screen size blank image at runtime, load your 10x10 image, and do tiling yourself by drawing the small image repeatedly into the blank image (once, at start up).

1 Like