[RESOLVED] Declaring a class function and using it inside the same class?

   def idle(self):
        if self.imgcount >  len(self.idle) - 1 :
                    self.imgcount = 0 
        if self.face == 'RIGHT':
                image(self.idle[self.imgcount],self.vec.x,self.vec.y,self.w,self.h)  
        elif self.face == 'LEFT':
                pushMatrix()
                scale(-1,1)
                image(self.idle[self.imgcount],-self.vec.x - self.w,self.vec.y,self.w,self.h)
                popMatrix()          
        self.imgcount += 1

    def show(self):        
        if not keyPressed:
            idle()

How to make this code work? It says idle() doesnt exist
(and this what I expected),but idk how to make it work
Full code here

1 Like

Hi,

I can’t test your code at the moment but the problem might be because of the missing “self.” before idle() on the last line.

2 Likes

It says:

processing.app.SketchException: TypeError: ‘list’ object is not callable

If you want you can download the full code here if you are interested

Ok, no problem, I did some simple code to try what you said,it worked, and I realized my error comes from somewhere else :relieved::relieved::crazy_face: