Image tiling for background.

Hi all

Sorry for all of the questions.

If I have a grass art tile that is approx 64x64, and I want to tile it to fit the iPad screen as a background and save the background as a variable. Is there an easy way to do this? Or am I better off doing it in a dedicated art program?

Seems like it wound be a pain and memory hog to place each tile individually.

check @Ignatz website. He has a great post on that.
http://codea.io/talk/discussion/5721/creating-a-seamless-image-for-tiling-using-shader/p1

@Crumable You can use setContext. Here’s an example. The grass tile I’m using here is 70x70.


displayMode(FULLSCREEN)

function setup()
    spriteMode(CORNER)
    img=readImage("Platformer Art:Block Grass")
    img1=image(WIDTH,HEIGHT)
    w=WIDTH/img.width
    h=HEIGHT/img.height
    setContext(img1)
    for x=0,w do
        for y=0,h do
           sprite(img,x*img.width,y*img.height) 
        end
    end
    setContext()
end

function draw()
    background(40, 40, 50)
    sprite(img1,0,0)
end

@Crumble - in this case, I would use dave’s method. My approach is best for 3D or when you have irregularly sized objects, or very large areas to tile.

Awesome! I learn so much from you guys! Thanks much