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
I didn’t upload the full code because it would be too long to fit on here.