tililng single background image
Monkey Forums/Monkey Beginners/tililng single background image
| ||
hey guys cant figure out how to tile a 1 image background. should i draw 2 of the same and put after the other or is there a better way. im sure single image bg's are probably not the best but just for practice. thanks |
| ||
Below is some code that draws rectangles on the screen so it fits the screen. Replace the drawrect with your drawimage and load an image. the step is the width and height of the image. DeviceWidth is the width of the monkey screen. For is a loop. Import mojo Class MyGame Extends App Method OnCreate() SetUpdateRate(60) End Method Method OnUpdate() End Method Method OnRender() Cls 0,0,0 SetColor 255,255,255 For Local y:=0 to DeviceHeight Step 64 For Local x:=0 to DeviceWidth Step 64 DrawRect x,y,32,32 Next Next End Method End Class Function Main() New MyGame() End Function |
| ||
thanks pakz but i have an image that is full screen already so wondering the best method to repeat one image over! |
| ||
Draw it next to the other one again? |
| ||
lol thats what i was thinking so just 2 drawimages.. ok wasnt sure what was the best method |
| ||
Mojo has no tiling feature, at least I don't know of any. So the only solution imho is to draw it as many times you need to. |