I get this error:
Traceback (most recent call last):
File "D:/Python26/PYTHON-PROGRAMME/049 bam", line 9, in <module>
ball[i][j]=sphere()
NameError: name 'ball' is not defined
when I run this code. But the ball is defined ( ball[i][j]=sphere() ). Isn`t it?
#2D-wave
#VPython
from visual import *
#ball array #ready
for i in range(5):
for y in range(5):
ball[i][j]=sphere()
timer = 0
dt = 0.001
while(1):
timer += dt
for i in range(5):
for y in range(5):
#wave equation
x = sqrt(i**2 + j**2) # x = distance to the source
ball[i][j].pos.y = amplitude * sin (k * x + omega * timer)
if timer > 5:
break