I need help with the translate() function

I’m trying to create a little game on codea and I have run into a little problem. Correct me if I’m wrong but doesn’t
Translate() draw the image again if you use popmatrix() and pushmatrix(). And if I am right could u take a look at my code to see what I’ve done wrong. If I’m wrong can u show me a way to do so.

-- Main

-- Use this function to perform your initial setup
function setup()
    displayMode(FULLSCREEN)
    ground = Ground()
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(0, 231, 255, 255)
    ground:draw()
    -- This sets the line thickness
    strokeWidth(5)

    -- Do your drawing here
    
end


Ground = class()

function Ground:init(x)
    -- you can accept and set parameters here
    self.model = "Planet Cute:Grass Block"
    self.position = vec2(100,75)
end

function Ground:draw()
    -- Codea does not automatically call this method
    pushMatrix()
    translate(self.position.x,self.position.y)
    for i = 1,10 do
    sprite(self.model,self.position.x*i,self.position.y)
    popMatrix()
        end
end

function Ground:touched(touch)
    -- Codea does not automatically call this method
end

P.S.
I didn’t upload the full code because it would be too long to fit on here.

@Butterhouse28 - Your draw function should either be this

--## 1. Not using translate
function Ground:draw()
    for i = 1,10 do
        sprite(self.model,self.position.x*i,self.position.y)
    end
end

or this, using translate

--## 2. Using translate
function Ground:draw()
    translate(0,self.position.y)
    for i = 1,10 do
        pushMatrix()
        translate(self.position.x*i,self.position.y)
        sprite(self.model,0,0)
        popMatrix()
    end
end

Method 1 simply tells Codea where to draw the sprite each time

Method 2 goes to (“translates” to) the spot where you want to draw the sprite, then draws it at 0,0 (because translating moves 0,0 to wherever you have translated).

PushMatrix and popMatrix simply allow you to undo the translation afterwards, by storing the original positions and restoring them later.

Normally, you only bother translating if want to rotate your image. To understand why, see my explanation on drawing, in my ebook on Codea, here

http://coolcodea.wordpress.com/2013/06/19/index-of-posts/

Thanks for the help