Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] Help, How to paint mosaic in wallpaper (scroll)

User Offline
Joined: 15th Oct 2018
Location: Barcelona
Posted: 23rd Apr 2019 15:55
I think this, many people ask this:
How to create a painted background repeatedly, mosaic using 1 infinite repeated texture?

I have a texture of 32x32, and I want to paint the entire wallpaper and move it infinitely in its x and y coordinates.

What is the best way? Use many sprites ???

It's simple ... But I do not know how.

The author of this post has marked a post as an answer.

Go to answer

Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 23rd Apr 2019 16:49 Edited at: 23rd Apr 2019 16:52
This post has been marked by the post author as the answer.
I think the simplest way is...

1) Load your image LoadImage()
2) Set the image wrapping on SetImageWrapU/V(im,1)
3) Create a sprite from the image CreateSprite(im)
4) Set the sprite size to be as large as you want your mosaic area to be SetSpriteSize()
4) Use SetSpriteUVScale(spr,0.1,0.1) so that the image is repeated 10 times. You can change how many times the image is repeated depending on how large your sprite is

You can also use SetSpriteUVOffset to the effectively scroll the view.

So if your image is 32x32 and your sprite is 320x320 then you would set the scale to be 0.1x0.1 or 32/SpriteWidth x 32/SpriteHeight
User Offline
Joined: 15th Oct 2018
Location: Barcelona
Posted: 23rd Apr 2019 21:18
All right! I worked, thanks for calculating and using the sprite functions.
I'm still a novice with Sprites management.

Login to post a reply

Server time is: 2019-08-20 10:53:32
Your offset time is: 2019-08-20 10:53:32