In my game I am trying to make with pygame i have my player able to shoot "bullets" created from instances of a class in an array (named "shots"), but when i try to delete them, the program crashes. Below is my code, what am I doing wrong that makes it crash?
for i in range(len(shots)):
shots[i].shoot()
shots[i].drawBullet()
if shots[i].x > swidth or shots[i].x < 0:
shots.pop(i)