Draw function not working properly

To add to @GoToLoop’s response – you overwrite the c1x value, so you’ll need a global c1x in the draw()

c1x = 10
v1 = 5

def draw():
  global c1x
  background(255)
  fill(0)
  rect(c1x, 200, 100, 100)
  c1x += v1

The same goes for c2x.

(you don’t reassign any values to v1 and v2, so it’s not necessary to insert a global for those)

2 Likes