x = 0
y = 0
tx = 0
ty = 0
def setup():
size(600, 600)
noStroke()
def draw():
background(0)
textAlign(LEFT,TOP)
# text("Hello World",x,y)
tx=mouseX
ty=mouseY
f=0.01
#The error: "UnboundLocalError: local variable 'x' referenced before assignment"
x=lerp(x,tx,f)
y=lerp(y,ty,f)
This is the processing python code. I am on Mac OSX High Sierra 10.13.1, using Processing 3.3.6 with Python Mode 3037.
This code gives "UnboundLocalError: local variable 'x' referenced before assignment" at the line immediately after the commented line in the code.
I am new to python and this seems to be what google says to do.
EDIT: Also, how would I reference global and instance variables in a class method?