Bug with python mode

ys = 0
g = 0.1
x = 300
y = 50

def setup():
    size(600,600)
    delay(1000)
def draw():
    # global ys
    # global g
    # global x
    # global y
    background(0)
    ys += g
    y += ys
    ellipse(x,y,15,15)

image

It says here that the variables declared at the top of the code will automatically become global variables. So why does it still need global? Is the tutorial outdated or for a different version of processing.py?

(I am learning processing.py through https://tabreturn.github.io/code/processing/python/2018/08/10/processing.py_in_ten_lessons-4.1-_animation.html )

1 Like